home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / tools / gcc / gcc270_src.lha / gcc-2.7.0-amiga / config / arm / arm.md < prev    next >
Encoding:
Text File  |  1995-06-15  |  174.3 KB  |  5,695 lines

  1. ;;- Machine description for Advanced RISC Machines' ARM for GNU compiler
  2. ;;  Copyright (C) 1991, 1993, 1994, 1995 Free Software Foundation, Inc.
  3. ;;  Contributed by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl)
  4. ;;             and Martin Simmons (@harleqn.co.uk).
  5. ;;  More major hacks by Richard Earnshaw (rwe11@cl.cam.ac.uk)
  6.  
  7. ;; This file is part of GNU CC.
  8.  
  9. ;; GNU CC is free software; you can redistribute it and/or modify
  10. ;; it under the terms of the GNU General Public License as published by
  11. ;; the Free Software Foundation; either version 2, or (at your option)
  12. ;; any later version.
  13.  
  14. ;; GNU CC is distributed in the hope that it will be useful,
  15. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. ;; GNU General Public License for more details.
  18.  
  19. ;; You should have received a copy of the GNU General Public License
  20. ;; along with GNU CC; see the file COPYING.  If not, write to
  21. ;; the Free Software Foundation, 59 Temple Place - Suite 330,
  22. ;; Boston, MA 02111-1307, USA.
  23.  
  24. ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
  25.  
  26. ;; There are patterns in this file to support XFmode arithmetic.
  27. ;; Unfortunately RISC iX doesn't work well with these so they are disabled.
  28. ;; (See arm.h)
  29.  
  30. ;; UNSPEC Usage:
  31. ;; 0 `sin' operation: operand 0 is the result, operand 1 the parameter,
  32. ;;   the mode is MODE_FLOAT
  33. ;; 1 `cos' operation: operand 0 is the result, operand 1 the parameter,
  34. ;;   the mode is MODE_FLOAT
  35. ;; 2 `push multiple' operation: operand 0 is the first register.  Subsequent
  36. ;;   registers are in parallel (use...) expressions.
  37.  
  38. ;; Attributes
  39.  
  40. ; condition codes: this one is used by final_prescan_insn to speed up
  41. ; conditionalizing instructions.  It saves having to scan the rtl to see if
  42. ; it uses or alters the condition codes.
  43.  
  44. ; USE means that the condition codes are used by the insn in the process of
  45. ; outputting code, this means (at present) that we can't use the insn in
  46. ; inlined branches
  47.  
  48. ; SET means that the purpose of the insn is to set the condition codes in a
  49. ; well defined manner.
  50.  
  51. ; CLOB means that the condition codes are altered in an undefined manner, if
  52. ; they are altered at all
  53.  
  54. ; JUMP_CLOB is used when the conditions are not defined if a branch is taken,
  55. ; but are if the branch wasn't taken; the effect is to limit the branch
  56. ; elimination scanning.
  57.  
  58. ; NOCOND means that the condition codes are neither altered nor affect the
  59. ; output of this insn
  60.  
  61. (define_attr "conds" "use,set,clob,jump_clob,nocond"
  62.     (const_string "nocond"))
  63.  
  64. ; CPU attribute is used to determine whether condition codes are clobbered
  65. ; by a call insn: on the arm6 they are if in 32-bit addressing mode; on the
  66. ; arm2 and arm3 the condition codes are restored by the return.
  67.  
  68. (define_attr "cpu" "arm2,arm3,arm6" (const (symbol_ref "arm_cpu_attr")))
  69.  
  70. ; Floating Point Unit.  If we only have floating point emulation, then there
  71. ; is no point in scheduling the floating point insns.  (Well, for best
  72. ; performance we should try and group them together).
  73.  
  74. (define_attr "fpu" "fpa,fpe" (const (symbol_ref "arm_fpu_attr")))
  75.  
  76. ; LENGTH of an instruction (in bytes)
  77. (define_attr "length" "" (const_int 4))
  78.  
  79. ; An assembler sequence may clobber the condition codes without us knowing
  80. (define_asm_attributes
  81.  [(set_attr "conds" "clob")
  82.   (set_attr "length" "4")])
  83.  
  84. ; TYPE attribute is used to detect floating point instructions which, if
  85. ; running on a co-processor can run in parallel with other, basic instructions
  86. ; If write-buffer scheduling is enabled then it can also be used in the
  87. ; scheduling of writes.
  88.  
  89. ; Classification of each insn
  90. ; normal    any data instruction that doesn't hit memory or fp regs
  91. ; block        blockage insn, this blocks all functional units
  92. ; float        a floating point arithmetic operation (subject to expansion)
  93. ; fdivx        XFmode floating point division
  94. ; fdivd        DFmode floating point division
  95. ; fdivs        SFmode floating point division
  96. ; fmul        Floating point multiply
  97. ; ffmul        Fast floating point multiply
  98. ; farith    Floating point arithmetic (4 cycle)
  99. ; ffarith    Fast floating point arithmetic (2 cycle)
  100. ; float_em    a floating point arithmetic operation that is normally emulated
  101. ;        even on a machine with an fpa.
  102. ; f_load    a floating point load from memory
  103. ; f_store    a floating point store to memory
  104. ; f_mem_r    a transfer of a floating point register to a real reg via mem
  105. ; r_mem_f    the reverse of f_mem_r
  106. ; f_2_r        fast transfer float to arm (no memory needed)
  107. ; r_2_f        fast transfer arm to float
  108. ; call        a subroutine call
  109. ; load        any load from memory
  110. ; store1    store 1 word to memory from arm registers
  111. ; store2    store 2 words
  112. ; store3    store 3 words
  113. ; store4    store 4 words
  114. ;
  115. (define_attr "type"
  116.     "normal,block,float,fdivx,fdivd,fdivs,fmul,ffmul,farith,ffarith,float_em,f_load,f_store,f_mem_r,r_mem_f,f_2_r,r_2_f,call,load,store1,store2,store3,store4" 
  117.     (const_string "normal"))
  118.  
  119. (define_attr "write_conflict" "no,yes"
  120.   (if_then_else (eq_attr "type"
  121.          "block,float_em,f_load,f_store,f_mem_r,r_mem_f,call,load")
  122.         (const_string "yes")
  123.         (const_string "no")))
  124.  
  125. ; The write buffer on some of the arm6 processors is hard to model exactly.
  126. ; There is room in the buffer for up to two addresses and up to eight words
  127. ; of memory, but the two needn't be split evenly.  When writing the two
  128. ; addresses are fully pipelined.  However, a read from memory that is not
  129. ; currently in the cache will block until the writes have completed.
  130. ; It is normally the case that FCLK and MCLK will be in the ratio 2:1, so
  131. ; writes will take 2 FCLK cycles per word, if FCLK and MCLK are asynchronous
  132. ; (they aren't allowed to be at present) then there is a startup cost of 1MCLK
  133. ; cycle to add as well.
  134.  
  135. ;; (define_function_unit {name} {num-units} {n-users} {test}
  136. ;;                       {ready-delay} {issue-delay} [{conflict-list}])
  137. (define_function_unit "fpa" 1 0 (and (eq_attr "fpu" "fpa")
  138.                      (eq_attr "type" "fdivx")) 71 69)
  139.  
  140. (define_function_unit "fpa" 1 0 (and (eq_attr "fpu" "fpa")
  141.                      (eq_attr "type" "fdivd")) 59 57)
  142.  
  143. (define_function_unit "fpa" 1 0 (and (eq_attr "fpu" "fpa")
  144.                      (eq_attr "type" "fdivs")) 31 29)
  145.  
  146. (define_function_unit "fpa" 1 0 (and (eq_attr "fpu" "fpa")
  147.                      (eq_attr "type" "fmul")) 9 7)
  148.  
  149. (define_function_unit "fpa" 1 0 (and (eq_attr "fpu" "fpa")
  150.                      (eq_attr "type" "ffmul")) 6 4)
  151.  
  152. (define_function_unit "fpa" 1 0 (and (eq_attr "fpu" "fpa")
  153.                      (eq_attr "type" "farith")) 4 2)
  154.  
  155. (define_function_unit "fpa" 1 0 (and (eq_attr "fpu" "fpa")
  156.                      (eq_attr "type" "ffarith")) 2 2)
  157.  
  158. (define_function_unit "fpa" 1 0 (and (eq_attr "fpu" "fpa")
  159.                      (eq_attr "type" "r_2_f")) 5 3)
  160.  
  161. (define_function_unit "fpa" 1 0 (and (eq_attr "fpu" "fpa")
  162.                      (eq_attr "type" "f_2_r")) 1 2)
  163.  
  164. ;; The fpa10 doesn't really have a memory read unit, but it can start to
  165. ;; speculatively execute the instruction in the pipeline, provided the data
  166. ;; is already loaded, so pretend reads have a delay of 2 (and that the
  167. ;; pipeline is infinite.
  168.  
  169. (define_function_unit "fpa_mem" 1 0 (and (eq_attr "fpu" "fpa")
  170.                      (eq_attr "type" "f_load")) 3 1)
  171.  
  172. (define_function_unit "write_buf" 1 2 (eq_attr "type" "store1") 3 3
  173.     [(eq_attr "write_conflict" "yes")])
  174. (define_function_unit "write_buf" 1 2 (eq_attr "type" "store2") 5 5
  175.     [(eq_attr "write_conflict" "yes")])
  176. (define_function_unit "write_buf" 1 2 (eq_attr "type" "store3") 7 7
  177.     [(eq_attr "write_conflict" "yes")])
  178. (define_function_unit "write_buf" 1 2 (eq_attr "type" "store4") 9 9
  179.     [(eq_attr "write_conflict" "yes")])
  180. (define_function_unit "write_buf" 1 2 (eq_attr "type" "r_mem_f") 3 3
  181.     [(eq_attr "write_conflict" "yes")])
  182.  
  183. ;; Note: For DImode insns, there is normally no reason why operands should
  184. ;; not be in the same register, what we don't want is for something being
  185. ;; written to partially overlap something that is an input.
  186.  
  187. ;; Addition insns.
  188.  
  189. (define_insn "adddi3"
  190.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
  191.     (plus:DI (match_operand:DI 1 "s_register_operand" "%0,0")
  192.          (match_operand:DI 2 "s_register_operand" "r,0")))
  193.    (clobber (reg:CC 24))]
  194.   ""
  195.   "adds\\t%0, %1, %2\;adc\\t%R0, %R1, %R2"
  196. [(set_attr "conds" "clob")
  197.  (set_attr "length" "8")])
  198.  
  199. (define_insn ""
  200.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
  201.     (plus:DI (sign_extend:DI
  202.           (match_operand:SI 1 "s_register_operand" "r,r"))
  203.          (match_operand:DI 2 "s_register_operand" "r,0")))
  204.    (clobber (reg:CC 24))]
  205.   ""
  206.   "adds\\t%0, %2, %1\;adc\\t%R0, %R2, %1, asr #31"
  207. [(set_attr "conds" "clob")
  208.  (set_attr "length" "8")])
  209.  
  210. (define_insn ""
  211.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
  212.     (plus:DI (zero_extend:DI
  213.           (match_operand:SI 1 "s_register_operand" "r,r"))
  214.          (match_operand:DI 2 "s_register_operand" "r,0")))
  215.    (clobber (reg:CC 24))]
  216.   ""
  217.   "adds\\t%0, %2, %1\;adc\\t%R0, %R2, #0"
  218. [(set_attr "conds" "clob")
  219.  (set_attr "length" "8")])
  220.  
  221. (define_expand "addsi3"
  222.   [(set (match_operand:SI 0 "s_register_operand" "")
  223.     (plus:SI (match_operand:SI 1 "s_register_operand" "")
  224.          (match_operand:SI 2 "reg_or_int_operand" "")))]
  225.   ""
  226.   "
  227.   if (GET_CODE (operands[2]) == CONST_INT)
  228.     {
  229.       arm_split_constant (PLUS, SImode, INTVAL (operands[2]), operands[0],
  230.               operands[1],
  231.               (reload_in_progress || reload_completed ? 0
  232.                : preserve_subexpressions_p ()));
  233.       DONE;
  234.     }
  235. ")
  236.  
  237. (define_split
  238.   [(set (match_operand:SI 0 "s_register_operand" "")
  239.     (plus:SI (match_operand:SI 1 "s_register_operand" "")
  240.          (match_operand:SI 2 "const_int_operand" "")))]
  241.   "! (const_ok_for_arm (INTVAL (operands[2]))
  242.       || const_ok_for_arm (-INTVAL (operands[2])))"
  243.   [(clobber (const_int 0))]
  244.   "
  245.   arm_split_constant (PLUS, SImode, INTVAL (operands[2]), operands[0],
  246.               operands[1], 0);
  247.   DONE;
  248. ")
  249.  
  250. (define_insn ""
  251.   [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
  252.     (plus:SI (match_operand:SI 1 "s_register_operand" "r,r,r")
  253.          (match_operand:SI 2 "reg_or_int_operand" "rI,L,?n")))]
  254.   ""
  255.   "@
  256.    add%?\\t%0, %1, %2
  257.    sub%?\\t%0, %1, #%n2
  258.    #"
  259. [(set_attr "length" "4,4,16")])
  260.  
  261. (define_insn ""
  262.   [(set (reg:CC_NOOV 24)
  263.     (compare:CC_NOOV
  264.      (plus:SI (match_operand:SI 1 "s_register_operand" "r,r")
  265.           (match_operand:SI 2 "arm_add_operand" "rI,L"))
  266.      (const_int 0)))
  267.    (set (match_operand:SI 0 "s_register_operand" "=r,r")
  268.     (plus:SI (match_dup 1) (match_dup 2)))]
  269.   ""
  270.   "@
  271.    add%?s\\t%0, %1, %2
  272.    sub%?s\\t%0, %1, #%n2"
  273. [(set_attr "conds" "set")])
  274.  
  275. (define_insn ""
  276.   [(set (reg:CC 24)
  277.     (compare:CC (match_operand:SI 1 "s_register_operand" "r,r")
  278.             (neg:SI (match_operand:SI 2 "arm_add_operand" "rI,L"))))
  279.    (set (match_operand:SI 0 "s_register_operand" "=r,r")
  280.     (plus:SI (match_dup 1) (match_dup 2)))]
  281.   ""
  282.   "@
  283.    add%?s\\t%0, %1, %2
  284.    sub%?s\\t%0, %1, #%n2"
  285. [(set_attr "conds" "set")])
  286.  
  287. (define_insn "incscc"
  288.   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
  289.         (plus:SI (match_operator:SI 2 "comparison_operator"
  290.                     [(reg 24) (const_int 0)])
  291.                  (match_operand:SI 1 "s_register_operand" "0,?r")))]
  292.   ""
  293.   "@
  294.   add%d2\\t%0, %1, #1
  295.   mov%D2\\t%0, %1\;add%d2\\t%0, %1, #1"
  296. [(set_attr "conds" "use")
  297.  (set_attr "length" "4,8")])
  298.  
  299. ; If a constant is too big to fit in a single instruction then the constant
  300. ; will be pre-loaded into a register taking at least two insns, we might be
  301. ; able to merge it with an add, but it depends on the exact value.
  302.  
  303. (define_split
  304.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  305.     (plus:SI (match_operand:SI 1 "s_register_operand" "r")
  306.          (match_operand:SI 2 "immediate_operand" "n")))]
  307.   "!(const_ok_for_arm (INTVAL (operands[2]))
  308.      || const_ok_for_arm (-INTVAL (operands[2])))"
  309.   [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))
  310.    (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
  311.   "
  312. {
  313.   unsigned int val = (unsigned) INTVAL (operands[2]);
  314.   int i;
  315.   unsigned int temp;
  316.  
  317.   /* this code is similar to the approach followed in movsi, but it must
  318.      generate exactly two insns */
  319.  
  320.   for (i = 30; i >= 0; i -= 2)
  321.     {
  322.       if (val & (3 << i))
  323.     {
  324.       i -= 6;
  325.       if (i < 0) i = 0;
  326.       if (const_ok_for_arm (temp = (val & ~(255 << i))))
  327.         {
  328.           val &= 255 << i;
  329.           break;
  330.         }
  331.       /* we might be able to do this as (larger number - small number) */
  332.       temp = ((val >> i) & 255) + 1;
  333.       if (temp > 255 && i < 24)
  334.         {
  335.           i += 2;
  336.           temp = ((val >> i) & 255) + 1;
  337.         }
  338.       if (const_ok_for_arm ((temp << i) - val))
  339.         {
  340.           i = temp << i;
  341.           temp = (unsigned) - (int) (i - val);
  342.           val = i;
  343.           break;
  344.         }
  345.       FAIL;
  346.     }
  347.     }
  348.   /* if we got here, we have found a way of doing it in two instructions.
  349.      the two constants are in val and temp */
  350.   operands[2] = GEN_INT ((int)val);
  351.   operands[3] = GEN_INT ((int)temp);
  352. }
  353. ")
  354.  
  355. (define_insn "addsf3"
  356.   [(set (match_operand:SF 0 "s_register_operand" "=f,f")
  357.     (plus:SF (match_operand:SF 1 "s_register_operand" "f,f")
  358.          (match_operand:SF 2 "fpu_add_operand" "fG,H")))]
  359.   "TARGET_HARD_FLOAT"
  360.   "@
  361.    adf%?s\\t%0, %1, %2
  362.    suf%?s\\t%0, %1, #%N2"
  363. [(set_attr "type" "farith")])
  364.  
  365. (define_insn "adddf3"
  366.   [(set (match_operand:DF 0 "s_register_operand" "=f,f")
  367.     (plus:DF (match_operand:DF 1 "s_register_operand" "f,f")
  368.          (match_operand:DF 2 "fpu_add_operand" "fG,H")))]
  369.   "TARGET_HARD_FLOAT"
  370.   "@
  371.    adf%?d\\t%0, %1, %2
  372.    suf%?d\\t%0, %1, #%N2"
  373. [(set_attr "type" "farith")])
  374.  
  375. (define_insn ""
  376.   [(set (match_operand:DF 0 "s_register_operand" "=f,f")
  377.     (plus:DF (float_extend:DF
  378.           (match_operand:SF 1 "s_register_operand" "f,f"))
  379.          (match_operand:DF 2 "fpu_add_operand" "fG,H")))]
  380.   "TARGET_HARD_FLOAT"
  381.   "@
  382.    adf%?d\\t%0, %1, %2
  383.    suf%?d\\t%0, %1, #%N2"
  384. [(set_attr "type" "farith")])
  385.  
  386. (define_insn ""
  387.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  388.     (plus:DF (match_operand:DF 1 "s_register_operand" "f")
  389.          (float_extend:DF
  390.           (match_operand:SF 2 "s_register_operand" "f"))))]
  391.   "TARGET_HARD_FLOAT"
  392.   "adf%?d\\t%0, %1, %2"
  393. [(set_attr "type" "farith")])
  394.  
  395. (define_insn ""
  396.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  397.     (plus:DF (float_extend:DF 
  398.           (match_operand:SF 1 "s_register_operand" "f"))
  399.          (float_extend:DF
  400.           (match_operand:SF 2 "s_register_operand" "f"))))]
  401.   "TARGET_HARD_FLOAT"
  402.   "adf%?d\\t%0, %1, %2"
  403. [(set_attr "type" "farith")])
  404.  
  405. (define_insn "addxf3"
  406.   [(set (match_operand:XF 0 "s_register_operand" "=f,f")
  407.     (plus:XF (match_operand:XF 1 "s_register_operand" "f,f")
  408.          (match_operand:XF 2 "fpu_add_operand" "fG,H")))]
  409.   "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
  410.   "@
  411.    adf%?e\\t%0, %1, %2
  412.    suf%?e\\t%0, %1, #%N2"
  413. [(set_attr "type" "farith")])
  414.  
  415. (define_insn "subdi3"
  416.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r,&r")
  417.     (minus:DI (match_operand:DI 1 "s_register_operand" "0,r,0")
  418.           (match_operand:DI 2 "s_register_operand" "r,0,0")))
  419.    (clobber (reg:CC 24))]
  420.   ""
  421.   "subs\\t%0, %1, %2\;sbc\\t%R0, %R1, %R2"
  422. [(set_attr "conds" "clob")
  423.  (set_attr "length" "8")])
  424.  
  425. (define_insn ""
  426.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
  427.     (minus:DI (match_operand:DI 1 "s_register_operand" "?r,0")
  428.           (zero_extend:DI
  429.            (match_operand:SI 2 "s_register_operand" "r,r"))))
  430.    (clobber (reg:CC 24))]
  431.   ""
  432.   "subs\\t%0, %1, %2\;sbc\\t%R0, %R1, #0"
  433. [(set_attr "conds" "clob")
  434.  (set_attr "length" "8")])
  435.  
  436. (define_insn ""
  437.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
  438.     (minus:DI (match_operand:DI 1 "s_register_operand" "r,0")
  439.           (sign_extend:DI
  440.            (match_operand:SI 2 "s_register_operand" "r,r"))))
  441.    (clobber (reg:CC 24))]
  442.   ""
  443.   "subs\\t%0, %1, %2\;sbc\\t%R0, %R1, %2, asr #31"
  444. [(set_attr "conds" "clob")
  445.  (set_attr "length" "8")])
  446.  
  447. (define_insn ""
  448.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
  449.     (minus:DI (zero_extend:DI
  450.            (match_operand:SI 2 "s_register_operand" "r,r"))
  451.           (match_operand:DI 1 "s_register_operand" "?r,0")))
  452.    (clobber (reg:CC 24))]
  453.   ""
  454.   "rsbs\\t%0, %1, %2\;rsc\\t%R0, %R1, #0"
  455. [(set_attr "conds" "clob")
  456.  (set_attr "length" "8")])
  457.  
  458. (define_insn ""
  459.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
  460.     (minus:DI (sign_extend:DI
  461.            (match_operand:SI 2 "s_register_operand" "r,r"))
  462.           (match_operand:DI 1 "s_register_operand" "?r,0")))
  463.    (clobber (reg:CC 24))]
  464.   ""
  465.   "rsbs\\t%0, %1, %2\;rsc\\t%R0, %R1, %2, asr #31"
  466. [(set_attr "conds" "clob")
  467.  (set_attr "length" "8")])
  468.  
  469. (define_insn ""
  470.   [(set (match_operand:DI 0 "s_register_operand" "=r")
  471.     (minus:DI (zero_extend:DI
  472.            (match_operand:SI 1 "s_register_operand" "r"))
  473.           (zero_extend:DI
  474.            (match_operand:SI 2 "s_register_operand" "r"))))
  475.    (clobber (reg:CC 24))]
  476.   ""
  477.   "subs\\t%0, %1, %2\;rsc\\t%R0, %1, %1"
  478. [(set_attr "conds" "clob")
  479.  (set_attr "length" "8")])
  480.  
  481. (define_expand "subsi3"
  482.   [(set (match_operand:SI 0 "s_register_operand" "")
  483.     (minus:SI (match_operand:SI 1 "reg_or_int_operand" "")
  484.           (match_operand:SI 2 "s_register_operand" "")))]
  485.   ""
  486.   "
  487.   if (GET_CODE (operands[1]) == CONST_INT)
  488.     {
  489.       arm_split_constant (MINUS, SImode, INTVAL (operands[1]), operands[0],
  490.               operands[2],
  491.               (reload_in_progress || reload_completed ? 0
  492.                : preserve_subexpressions_p ()));
  493.       DONE;
  494.     }
  495. ")
  496.  
  497. (define_insn ""
  498.   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
  499.     (minus:SI (match_operand:SI 1 "reg_or_int_operand" "rI,?n")
  500.           (match_operand:SI 2 "s_register_operand" "r,r")))]
  501.   ""
  502.   "@
  503.    rsb%?\\t%0, %2, %1
  504.    #"
  505. [(set_attr "length" "4,16")])
  506.  
  507. (define_split
  508.   [(set (match_operand:SI 0 "s_register_operand" "")
  509.     (minus:SI (match_operand:SI 1 "const_int_operand" "")
  510.           (match_operand:SI 2 "s_register_operand" "")))]
  511.   "! const_ok_for_arm (INTVAL (operands[1]))"
  512.   [(clobber (const_int 0))]
  513.   "
  514.   arm_split_constant (MINUS, SImode, INTVAL (operands[1]), operands[0],
  515.               operands[2], 0);
  516.   DONE;
  517. ")
  518.  
  519. (define_insn ""
  520.   [(set (reg:CC_NOOV 24)
  521.     (compare:CC_NOOV (minus:SI (match_operand:SI 1 "arm_rhs_operand" "r,I")
  522.                  (match_operand:SI 2 "arm_rhs_operand" "rI,r"))
  523.              (const_int 0)))
  524.    (set (match_operand:SI 0 "s_register_operand" "=r,r")
  525.     (minus:SI (match_dup 1) (match_dup 2)))]
  526.   ""
  527.   "@
  528.    sub%?s\\t%0, %1, %2
  529.    rsb%?s\\t%0, %2, %1"
  530. [(set_attr "conds" "set")])
  531.  
  532. (define_insn "decscc"
  533.   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
  534.         (minus:SI (match_operand:SI 1 "s_register_operand" "0,?r")
  535.           (match_operator:SI 2 "comparison_operator"
  536.                    [(reg 24) (const_int 0)])))]
  537.   ""
  538.   "@
  539.   sub%d2\\t%0, %1, #1
  540.   mov%D2\\t%0, %1\;sub%d2\\t%0, %1, #1"
  541. [(set_attr "conds" "use")
  542.  (set_attr "length" "*,8")])
  543.  
  544. (define_insn "subsf3"
  545.   [(set (match_operand:SF 0 "s_register_operand" "=f,f")
  546.     (minus:SF (match_operand:SF 1 "fpu_rhs_operand" "f,G")
  547.           (match_operand:SF 2 "fpu_rhs_operand" "fG,f")))]
  548.   "TARGET_HARD_FLOAT"
  549.   "@
  550.    suf%?s\\t%0, %1, %2
  551.    rsf%?s\\t%0, %2, %1"
  552. [(set_attr "type" "farith")])
  553.  
  554. (define_insn "subdf3"
  555.   [(set (match_operand:DF 0 "s_register_operand" "=f,f")
  556.     (minus:DF (match_operand:DF 1 "fpu_rhs_operand" "f,G")
  557.           (match_operand:DF 2 "fpu_rhs_operand" "fG,f")))]
  558.   "TARGET_HARD_FLOAT"
  559.   "@
  560.    suf%?d\\t%0, %1, %2
  561.    rsf%?d\\t%0, %2, %1"
  562. [(set_attr "type" "farith")])
  563.  
  564. (define_insn ""
  565.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  566.     (minus:DF (float_extend:DF
  567.            (match_operand:SF 1 "s_register_operand" "f"))
  568.           (match_operand:DF 2 "fpu_rhs_operand" "fG")))]
  569.   "TARGET_HARD_FLOAT"
  570.   "suf%?d\\t%0, %1, %2"
  571. [(set_attr "type" "farith")])
  572.  
  573. (define_insn ""
  574.   [(set (match_operand:DF 0 "s_register_operand" "=f,f")
  575.     (minus:DF (match_operand:DF 1 "fpu_rhs_operand" "f,G")
  576.           (float_extend:DF
  577.            (match_operand:SF 2 "s_register_operand" "f,f"))))]
  578.   "TARGET_HARD_FLOAT"
  579.   "@
  580.    suf%?d\\t%0, %1, %2
  581.    rsf%?d\\t%0, %2, %1"
  582. [(set_attr "type" "farith")])
  583.  
  584. (define_insn ""
  585.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  586.     (minus:DF (float_extend:DF
  587.            (match_operand:SF 1 "s_register_operand" "f"))
  588.           (float_extend:DF
  589.            (match_operand:SF 2 "s_register_operand" "f"))))]
  590.   "TARGET_HARD_FLOAT"
  591.   "suf%?d\\t%0, %1, %2"
  592. [(set_attr "type" "farith")])
  593.  
  594. (define_insn "subxf3"
  595.   [(set (match_operand:XF 0 "s_register_operand" "=f,f")
  596.     (minus:XF (match_operand:XF 1 "fpu_rhs_operand" "f,G")
  597.           (match_operand:XF 2 "fpu_rhs_operand" "fG,f")))]
  598.   "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
  599.   "@
  600.    suf%?e\\t%0, %1, %2
  601.    rsf%?e\\t%0, %2, %1"
  602. [(set_attr "type" "farith")])
  603.  
  604. ;; Multiplication insns
  605.  
  606. ;; Use `&' and then `0' to prevent the operands 0 and 1 being the same
  607. (define_insn "mulsi3"
  608.   [(set (match_operand:SI 0 "s_register_operand" "=&r,&r")
  609.     (mult:SI (match_operand:SI 2 "s_register_operand" "r,r")
  610.          (match_operand:SI 1 "s_register_operand" "%?r,0")))]
  611.   ""
  612.   "mul%?\\t%0, %2, %1")
  613.  
  614. (define_insn ""
  615.   [(set (reg:CC_NOOV 24)
  616.     (compare:CC_NOOV (mult:SI
  617.               (match_operand:SI 2 "s_register_operand" "r,r")
  618.               (match_operand:SI 1 "s_register_operand" "%?r,0"))
  619.              (const_int 0)))
  620.    (set (match_operand:SI 0 "s_register_operand" "=&r,&r")
  621.     (mult:SI (match_dup 2) (match_dup 1)))]
  622.   ""
  623.   "mul%?s\\t%0, %2, %1"
  624. [(set_attr "conds" "set")])
  625.  
  626. (define_insn ""
  627.   [(set (reg:CC_NOOV 24)
  628.     (compare:CC_NOOV (mult:SI
  629.               (match_operand:SI 2 "s_register_operand" "r,r")
  630.               (match_operand:SI 1 "s_register_operand" "%?r,0"))
  631.              (const_int 0)))
  632.    (clobber (match_scratch:SI 0 "=&r,&r"))]
  633.   ""
  634.   "mul%?s\\t%0, %2, %1"
  635. [(set_attr "conds" "set")])
  636.  
  637. ;; Unnamed templates to match MLA instruction.
  638.  
  639. (define_insn ""
  640.   [(set (match_operand:SI 0 "s_register_operand" "=&r,&r,&r,&r")
  641.     (plus:SI
  642.       (mult:SI (match_operand:SI 2 "s_register_operand" "r,r,r,r")
  643.            (match_operand:SI 1 "s_register_operand" "%r,0,r,0"))
  644.       (match_operand:SI 3 "s_register_operand" "?r,r,0,0")))]
  645.   ""
  646.   "mla%?\\t%0, %2, %1, %3")
  647.  
  648. (define_insn ""
  649.   [(set (reg:CC_NOOV 24)
  650.     (compare:CC_NOOV (plus:SI
  651.               (mult:SI
  652.                (match_operand:SI 2 "s_register_operand" "r,r,r,r")
  653.                (match_operand:SI 1 "s_register_operand" "%r,0,r,0"))
  654.               (match_operand:SI 3 "s_register_operand" "?r,r,0,0"))
  655.              (const_int 0)))
  656.    (set (match_operand:SI 0 "s_register_operand" "=&r,&r,&r,&r")
  657.     (plus:SI (mult:SI (match_dup 2) (match_dup 1))
  658.          (match_dup 3)))]
  659.   ""
  660.   "mla%?s\\t%0, %2, %1, %3"
  661. [(set_attr "conds" "set")])
  662.  
  663. (define_insn ""
  664.   [(set (reg:CC_NOOV 24)
  665.     (compare:CC_NOOV (plus:SI
  666.               (mult:SI
  667.                (match_operand:SI 2 "s_register_operand" "r,r,r,r")
  668.                (match_operand:SI 1 "s_register_operand" "%r,0,r,0"))
  669.               (match_operand:SI 3 "s_register_operand" "?r,r,0,0"))
  670.              (const_int 0)))
  671.    (clobber (match_scratch:SI 0 "=&r,&r,&r,&r"))]
  672.   ""
  673.   "mla%?s\\t%0, %2, %1, %3"
  674. [(set_attr "conds" "set")])
  675.  
  676. (define_insn "mulsf3"
  677.   [(set (match_operand:SF 0 "s_register_operand" "=f")
  678.     (mult:SF (match_operand:SF 1 "s_register_operand" "f")
  679.          (match_operand:SF 2 "fpu_rhs_operand" "fG")))]
  680.   "TARGET_HARD_FLOAT"
  681.   "fml%?s\\t%0, %1, %2"
  682. [(set_attr "type" "ffmul")])
  683.  
  684. (define_insn "muldf3"
  685.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  686.     (mult:DF (match_operand:DF 1 "s_register_operand" "f")
  687.          (match_operand:DF 2 "fpu_rhs_operand" "fG")))]
  688.   "TARGET_HARD_FLOAT"
  689.   "muf%?d\\t%0, %1, %2"
  690. [(set_attr "type" "fmul")])
  691.  
  692. (define_insn ""
  693.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  694.     (mult:DF (float_extend:DF
  695.           (match_operand:SF 1 "s_register_operand" "f"))
  696.          (match_operand:DF 2 "fpu_rhs_operand" "fG")))]
  697.   "TARGET_HARD_FLOAT"
  698.   "muf%?d\\t%0, %1, %2"
  699. [(set_attr "type" "fmul")])
  700.  
  701. (define_insn ""
  702.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  703.     (mult:DF (match_operand:DF 1 "s_register_operand" "f")
  704.          (float_extend:DF
  705.           (match_operand:SF 2 "s_register_operand" "f"))))]
  706.   "TARGET_HARD_FLOAT"
  707.   "muf%?d\\t%0, %1, %2"
  708. [(set_attr "type" "fmul")])
  709.  
  710. (define_insn ""
  711.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  712.     (mult:DF (float_extend:DF
  713.           (match_operand:SF 1 "s_register_operand" "f"))
  714.          (float_extend:DF
  715.           (match_operand:SF 2 "s_register_operand" "f"))))]
  716.   "TARGET_HARD_FLOAT"
  717.   "muf%?d\\t%0, %1, %2"
  718. [(set_attr "type" "fmul")])
  719.  
  720. (define_insn "mulxf3"
  721.   [(set (match_operand:XF 0 "s_register_operand" "=f")
  722.     (mult:XF (match_operand:XF 1 "s_register_operand" "f")
  723.          (match_operand:XF 2 "fpu_rhs_operand" "fG")))]
  724.   "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
  725.   "muf%?e\\t%0, %1, %2"
  726. [(set_attr "type" "fmul")])
  727.  
  728. ;; Division insns
  729.  
  730. (define_insn "divsf3"
  731.   [(set (match_operand:SF 0 "s_register_operand" "=f,f")
  732.     (div:SF (match_operand:SF 1 "fpu_rhs_operand" "f,G")
  733.         (match_operand:SF 2 "fpu_rhs_operand" "fG,f")))]
  734.   "TARGET_HARD_FLOAT"
  735.   "@
  736.    fdv%?s\\t%0, %1, %2
  737.    frd%?s\\t%0, %2, %1"
  738. [(set_attr "type" "fdivs")])
  739.  
  740. (define_insn "divdf3"
  741.   [(set (match_operand:DF 0 "s_register_operand" "=f,f")
  742.     (div:DF (match_operand:DF 1 "fpu_rhs_operand" "f,G")
  743.         (match_operand:DF 2 "fpu_rhs_operand" "fG,f")))]
  744.   "TARGET_HARD_FLOAT"
  745.   "@
  746.    dvf%?d\\t%0, %1, %2
  747.    rdf%?d\\t%0, %2, %1"
  748. [(set_attr "type" "fdivd")])
  749.  
  750. (define_insn ""
  751.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  752.     (div:DF (float_extend:DF
  753.          (match_operand:SF 1 "s_register_operand" "f"))
  754.         (match_operand:DF 2 "fpu_rhs_operand" "fG")))]
  755.   "TARGET_HARD_FLOAT"
  756.   "dvf%?d\\t%0, %1, %2"
  757. [(set_attr "type" "fdivd")])
  758.  
  759. (define_insn ""
  760.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  761.     (div:DF (match_operand:DF 1 "fpu_rhs_operand" "fG")
  762.         (float_extend:DF
  763.          (match_operand:SF 2 "s_register_operand" "f"))))]
  764.   "TARGET_HARD_FLOAT"
  765.   "rdf%?d\\t%0, %2, %1"
  766. [(set_attr "type" "fdivd")])
  767.  
  768. (define_insn ""
  769.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  770.     (div:DF (float_extend:DF
  771.          (match_operand:SF 1 "s_register_operand" "f"))
  772.         (float_extend:DF
  773.          (match_operand:SF 2 "s_register_operand" "f"))))]
  774.   "TARGET_HARD_FLOAT"
  775.   "dvf%?d\\t%0, %1, %2"
  776. [(set_attr "type" "fdivd")])
  777.  
  778. (define_insn "divxf3"
  779.   [(set (match_operand:XF 0 "s_register_operand" "=f,f")
  780.     (div:XF (match_operand:XF 1 "fpu_rhs_operand" "f,G")
  781.         (match_operand:XF 2 "fpu_rhs_operand" "fG,f")))]
  782.   "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
  783.   "@
  784.    dvf%?e\\t%0, %1, %2
  785.    rdf%?e\\t%0, %2, %1"
  786. [(set_attr "type" "fdivx")])
  787.  
  788. ;; Modulo insns
  789.  
  790. (define_insn "modsf3"
  791.   [(set (match_operand:SF 0 "s_register_operand" "=f")
  792.     (mod:SF (match_operand:SF 1 "s_register_operand" "f")
  793.         (match_operand:SF 2 "fpu_rhs_operand" "fG")))]
  794.   "TARGET_HARD_FLOAT"
  795.   "rmf%?s\\t%0, %1, %2"
  796. [(set_attr "type" "fdivs")])
  797.  
  798. (define_insn "moddf3"
  799.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  800.     (mod:DF (match_operand:DF 1 "s_register_operand" "f")
  801.         (match_operand:DF 2 "fpu_rhs_operand" "fG")))]
  802.   "TARGET_HARD_FLOAT"
  803.   "rmf%?d\\t%0, %1, %2"
  804. [(set_attr "type" "fdivd")])
  805.  
  806. (define_insn ""
  807.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  808.     (mod:DF (float_extend:DF
  809.          (match_operand:SF 1 "s_register_operand" "f"))
  810.         (match_operand:DF 2 "fpu_rhs_operand" "fG")))]
  811.   "TARGET_HARD_FLOAT"
  812.   "rmf%?d\\t%0, %1, %2"
  813. [(set_attr "type" "fdivd")])
  814.  
  815. (define_insn ""
  816.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  817.     (mod:DF (match_operand:DF 1 "s_register_operand" "f")
  818.         (float_extend:DF
  819.          (match_operand:SF 2 "s_register_operand" "f"))))]
  820.   "TARGET_HARD_FLOAT"
  821.   "rmf%?d\\t%0, %1, %2"
  822. [(set_attr "type" "fdivd")])
  823.  
  824. (define_insn ""
  825.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  826.     (mod:DF (float_extend:DF
  827.          (match_operand:SF 1 "s_register_operand" "f"))
  828.         (float_extend:DF
  829.          (match_operand:SF 2 "s_register_operand" "f"))))]
  830.   "TARGET_HARD_FLOAT"
  831.   "rmf%?d\\t%0, %1, %2"
  832. [(set_attr "type" "fdivd")])
  833.  
  834. (define_insn "modxf3"
  835.   [(set (match_operand:XF 0 "s_register_operand" "=f")
  836.     (mod:XF (match_operand:XF 1 "s_register_operand" "f")
  837.         (match_operand:XF 2 "fpu_rhs_operand" "fG")))]
  838.   "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
  839.   "rmf%?e\\t%0, %1, %2"
  840. [(set_attr "type" "fdivx")])
  841.  
  842. ;; Boolean and,ior,xor insns
  843.  
  844. (define_insn "anddi3"
  845.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
  846.     (and:DI (match_operand:DI 1 "s_register_operand" "%0,0")
  847.         (match_operand:DI 2 "s_register_operand" "r,0")))]
  848.   ""
  849.   "and%?\\t%0, %1, %2\;and%?\\t%R0, %R1, %R2"
  850. [(set_attr "length" "8")])
  851.  
  852. (define_insn ""
  853.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
  854.     (and:DI (zero_extend:DI
  855.          (match_operand:SI 2 "s_register_operand" "r,r"))
  856.         (match_operand:DI 1 "s_register_operand" "?r,0")))]
  857.   ""
  858.   "and%?\\t%0, %1, %2\;mov%?\\t%R0, #0"
  859. [(set_attr "length" "8")])
  860.  
  861. (define_insn ""
  862.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
  863.     (and:DI (sign_extend:DI
  864.          (match_operand:SI 2 "s_register_operand" "r,r"))
  865.         (match_operand:DI 1 "s_register_operand" "?r,0")))]
  866.   ""
  867.   "and%?\\t%0, %1, %2\;and%?\\t%R0, %R1, %2, asr #31"
  868. [(set_attr "length" "8")])
  869.  
  870. (define_expand "andsi3"
  871.   [(set (match_operand:SI 0 "s_register_operand" "")
  872.     (and:SI (match_operand:SI 1 "s_register_operand" "")
  873.         (match_operand:SI 2 "reg_or_int_operand" "")))]
  874.   ""
  875.   "
  876.   if (GET_CODE (operands[2]) == CONST_INT)
  877.     {
  878.       arm_split_constant (AND, SImode, INTVAL (operands[2]), operands[0],
  879.               operands[1],
  880.               (reload_in_progress || reload_completed
  881.                ? 0 : preserve_subexpressions_p ()));
  882.       DONE;
  883.     }
  884. ")
  885.  
  886. (define_insn ""
  887.   [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
  888.     (and:SI (match_operand:SI 1 "s_register_operand" "r,r,r")
  889.         (match_operand:SI 2 "reg_or_int_operand" "rI,K,?n")))]
  890.   ""
  891.   "@
  892.    and%?\\t%0, %1, %2
  893.    bic%?\\t%0, %1, #%B2
  894.    #"
  895. [(set_attr "length" "4,4,16")])
  896.  
  897. (define_split
  898.   [(set (match_operand:SI 0 "s_register_operand" "")
  899.     (and:SI (match_operand:SI 1 "s_register_operand" "")
  900.         (match_operand:SI 2 "const_int_operand" "")))]
  901.   "! (const_ok_for_arm (INTVAL (operands[2]))
  902.       || const_ok_for_arm (~ INTVAL (operands[2])))"
  903.   [(clobber (const_int 0))]
  904.   "
  905.   arm_split_constant  (AND, SImode, INTVAL (operands[2]), operands[0],
  906.                operands[1], 0);
  907.   DONE;
  908. ")
  909.  
  910. (define_insn ""
  911.   [(set (reg:CC_NOOV 24)
  912.     (compare:CC_NOOV
  913.      (and:SI (match_operand:SI 1 "s_register_operand" "r,r")
  914.          (match_operand:SI 2 "arm_not_operand" "rI,K"))
  915.      (const_int 0)))
  916.    (set (match_operand:SI 0 "s_register_operand" "=r,r")
  917.     (and:SI (match_dup 1) (match_dup 2)))]
  918.   ""
  919.   "@
  920.    and%?s\\t%0, %1, %2
  921.    bic%?s\\t%0, %1, #%B2"
  922. [(set_attr "conds" "set")])
  923.  
  924. (define_insn ""
  925.   [(set (reg:CC_NOOV 24)
  926.     (compare:CC_NOOV
  927.      (and:SI (match_operand:SI 0 "s_register_operand" "r,r")
  928.          (match_operand:SI 1 "arm_not_operand" "rI,K"))
  929.      (const_int 0)))
  930.    (clobber (match_scratch:SI 3 "=X,r"))]
  931.   ""
  932.   "@
  933.    tst%?\\t%0, %1
  934.    bic%?s\\t%3, %0, #%B1"
  935. [(set_attr "conds" "set")])
  936.  
  937. (define_insn ""
  938.   [(set (reg:CC_NOOV 24)
  939.     (compare:CC_NOOV (zero_extract:SI
  940.               (match_operand:SI 0 "s_register_operand" "r")
  941.                (match_operand:SI 1 "immediate_operand" "n")
  942.               (match_operand:SI 2 "immediate_operand" "n"))
  943.              (const_int 0)))]
  944.   "INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) < 32
  945.    && INTVAL (operands[1]) > 0 
  946.    && INTVAL (operands[1]) + (INTVAL (operands[2]) & 1) <= 8
  947.    && INTVAL (operands[1]) + INTVAL (operands[2]) <= 32"
  948.   "*
  949. {
  950.   unsigned int mask = 0;
  951.   int cnt = INTVAL (operands[1]);
  952.   
  953.   while (cnt--)
  954.     mask = (mask << 1) | 1;
  955.   operands[1] = GEN_INT (mask << INTVAL (operands[2]));
  956.   output_asm_insn (\"tst%?\\t%0, %1\", operands);
  957.   return \"\";
  958. }
  959. "
  960. [(set_attr "conds" "set")])
  961.  
  962. (define_insn ""
  963.   [(set (reg:CC_NOOV 24)
  964.     (compare:CC_NOOV (zero_extract:SI
  965.               (match_operand:QI 0 "memory_operand" "m")
  966.                (match_operand 1 "immediate_operand" "n")
  967.               (match_operand 2 "immediate_operand" "n"))
  968.              (const_int 0)))
  969.    (clobber (match_scratch:QI 3 "=r"))]
  970.   "INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) < 8
  971.    && INTVAL (operands[1]) > 0 && INTVAL (operands[1]) <= 8"
  972.   "*
  973. {
  974.   unsigned int mask = 0;
  975.   int cnt = INTVAL (operands[1]);
  976.   
  977.   while (cnt--)
  978.     mask = (mask << 1) | 1;
  979.   operands[1] = GEN_INT (mask << INTVAL (operands[2]));
  980.   output_asm_insn (\"ldr%?b\\t%3, %0\", operands);
  981.   output_asm_insn (\"tst%?\\t%3, %1\", operands);
  982.   return \"\";
  983. }
  984. "
  985. [(set_attr "conds" "set")
  986.  (set_attr "length" "8")])
  987.  
  988. ;; constants for op 2 will never be given to these patterns.
  989. (define_insn ""
  990.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
  991.     (and:DI (not:DI (match_operand:DI 2 "s_register_operand" "r,0"))
  992.         (match_operand:DI 1 "s_register_operand" "0,r")))]
  993.   ""
  994.   "bic%?\\t%0, %1, %2\;bic%?\\t%R0, %R1, %R2"
  995. [(set_attr "length" "8")])
  996.   
  997. (define_insn ""
  998.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
  999.     (and:DI (not:DI (zero_extend:DI
  1000.              (match_operand:SI 2 "s_register_operand" "r,r")))
  1001.         (match_operand:DI 1 "s_register_operand" "0,?r")))]
  1002.   ""
  1003.   "@
  1004.    bic%?\\t%0, %1, %2
  1005.    bic%?\\t%0, %1, %2\;mov%?\\t%R0, %R1"
  1006. [(set_attr "length" "4,8")])
  1007.   
  1008. (define_insn ""
  1009.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
  1010.     (and:DI (not:DI (sign_extend:DI
  1011.              (match_operand:SI 2 "s_register_operand" "r,r")))
  1012.         (match_operand:DI 1 "s_register_operand" "?r,0")))]
  1013.   ""
  1014.   "bic%?\\t%0, %1, %2\;bic%?\\t%R0, %R1, %2, asr #31"
  1015. [(set_attr "length" "8")])
  1016.   
  1017. (define_insn ""
  1018.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  1019.     (and:SI (not:SI (match_operand:SI 2 "s_register_operand" "r"))
  1020.         (match_operand:SI 1 "s_register_operand" "r")))]
  1021.   ""
  1022.   "bic%?\\t%0, %1, %2")
  1023.  
  1024. (define_insn ""
  1025.   [(set (reg:CC_NOOV 24)
  1026.     (compare:CC_NOOV
  1027.      (and:SI (not:SI (match_operand:SI 2 "s_register_operand" "r"))
  1028.          (match_operand:SI 1 "s_register_operand" "r"))
  1029.      (const_int 0)))
  1030.    (set (match_operand:SI 0 "s_register_operand" "=r")
  1031.     (and:SI (not:SI (match_dup 2)) (match_dup 1)))]
  1032.   ""
  1033.   "bic%?s\\t%0, %1, %2"
  1034. [(set_attr "conds" "set")])
  1035.  
  1036. (define_insn ""
  1037.   [(set (reg:CC_NOOV 24)
  1038.     (compare:CC_NOOV
  1039.      (and:SI (not:SI (match_operand:SI 2 "s_register_operand" "r"))
  1040.          (match_operand:SI 1 "s_register_operand" "r"))
  1041.      (const_int 0)))
  1042.    (clobber (match_scratch:SI 0 "=r"))]
  1043.   ""
  1044.   "bic%?s\\t%0, %1, %2"
  1045. [(set_attr "conds" "set")])
  1046.  
  1047. (define_insn "iordi3"
  1048.   [(set (match_operand:DI 0 "s_register_operand" "=&r")
  1049.     (ior:DI (match_operand:DI 1 "s_register_operand" "%0")
  1050.         (match_operand:DI 2 "s_register_operand" "r")))]
  1051.   ""
  1052.   "orr%?\\t%0, %1, %2\;orr%?\\t%R0, %R1, %R2"
  1053. [(set_attr "length" "8")])
  1054.  
  1055. (define_insn ""
  1056.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
  1057.     (ior:DI (zero_extend:DI
  1058.          (match_operand:SI 2 "s_register_operand" "r,r"))
  1059.         (match_operand:DI 1 "s_register_operand" "0,?r")))]
  1060.   ""
  1061.   "@
  1062.    orr%?\\t%0, %1, %2
  1063.    orr%?\\t%0, %1, %2\;mov%?\\t%R0, %R1"
  1064. [(set_attr "length" "4,8")])
  1065.  
  1066. (define_insn ""
  1067.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
  1068.     (ior:DI (sign_extend:DI
  1069.          (match_operand:SI 2 "s_register_operand" "r,r"))
  1070.         (match_operand:DI 1 "s_register_operand" "?r,0")))]
  1071.   ""
  1072.   "orr%?\\t%0, %1, %2\;orr%?\\t%R0, %R1, %2, asr #31"
  1073. [(set_attr "length" "8")])
  1074.  
  1075. (define_expand "iorsi3"
  1076.   [(set (match_operand:SI 0 "s_register_operand" "")
  1077.     (ior:SI (match_operand:SI 1 "s_register_operand" "")
  1078.         (match_operand:SI 2 "reg_or_int_operand" "")))]
  1079.   ""
  1080.   "
  1081.   if (GET_CODE (operands[2]) == CONST_INT)
  1082.     {
  1083.       arm_split_constant (IOR, SImode, INTVAL (operands[2]), operands[0],
  1084.               operands[1],
  1085.               (reload_in_progress || reload_completed
  1086.                ? 0 : preserve_subexpressions_p ()));
  1087.       DONE;
  1088.     }
  1089. ")
  1090.  
  1091. (define_insn ""
  1092.   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
  1093.     (ior:SI (match_operand:SI 1 "s_register_operand" "r,r")
  1094.         (match_operand:SI 2 "reg_or_int_operand" "rI,?n")))]
  1095.   ""
  1096.   "@
  1097.    orr%?\\t%0, %1, %2
  1098.    #"
  1099. [(set_attr "length" "4,16")])
  1100.  
  1101. (define_split
  1102.   [(set (match_operand:SI 0 "s_register_operand" "")
  1103.     (ior:SI (match_operand:SI 1 "s_register_operand" "")
  1104.         (match_operand:SI 2 "const_int_operand" "")))]
  1105.   "! const_ok_for_arm (INTVAL (operands[2]))"
  1106.   [(clobber (const_int 0))]
  1107.   "
  1108.   arm_split_constant (IOR, SImode, INTVAL (operands[2]), operands[0],
  1109.               operands[1], 0);
  1110.   DONE;
  1111. ")
  1112.   
  1113. (define_insn ""
  1114.   [(set (reg:CC_NOOV 24)
  1115.     (compare:CC_NOOV (ior:SI (match_operand:SI 1 "s_register_operand" "%r")
  1116.                  (match_operand:SI 2 "arm_rhs_operand" "rI"))
  1117.              (const_int 0)))
  1118.    (set (match_operand:SI 0 "s_register_operand" "=r")
  1119.     (ior:SI (match_dup 1) (match_dup 2)))]
  1120.   ""
  1121.   "orr%?s\\t%0, %1, %2"
  1122. [(set_attr "conds" "set")])
  1123.  
  1124. (define_insn ""
  1125.   [(set (reg:CC_NOOV 24)
  1126.     (compare:CC_NOOV (ior:SI (match_operand:SI 1 "s_register_operand" "%r")
  1127.                  (match_operand:SI 2 "arm_rhs_operand" "rI"))
  1128.              (const_int 0)))
  1129.    (clobber (match_scratch:SI 0 "=r"))]
  1130.   ""
  1131.   "orr%?s\\t%0, %1, %2"
  1132. [(set_attr "conds" "set")])
  1133.  
  1134. (define_insn "xordi3"
  1135.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
  1136.     (xor:DI (match_operand:DI 1 "s_register_operand" "%0,0")
  1137.         (match_operand:DI 2 "s_register_operand" "r,0")))]
  1138.   ""
  1139.   "eor%?\\t%0, %1, %2\;eor%?\\t%R0, %R1, %R2"
  1140. [(set_attr "length" "8")])
  1141.  
  1142. (define_insn ""
  1143.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
  1144.     (xor:DI (zero_extend:DI
  1145.          (match_operand:SI 2 "s_register_operand" "r,r"))
  1146.         (match_operand:DI 1 "s_register_operand" "0,?r")))]
  1147.   ""
  1148.   "@
  1149.    eor%?\\t%0, %1, %2
  1150.    eor%?\\t%0, %1, %2\;mov%?\\t%R0, %R1"
  1151. [(set_attr "length" "4,8")])
  1152.  
  1153. (define_insn ""
  1154.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
  1155.     (xor:DI (sign_extend:DI
  1156.          (match_operand:SI 2 "s_register_operand" "r,r"))
  1157.         (match_operand:DI 1 "s_register_operand" "?r,0")))]
  1158.   ""
  1159.   "eor%?\\t%0, %1, %2\;eor%?\\t%R0, %R1, %2, asr #31"
  1160. [(set_attr "length" "8")])
  1161.  
  1162. (define_insn "xorsi3"
  1163.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  1164.     (xor:SI (match_operand:SI 1 "s_register_operand" "r")
  1165.         (match_operand:SI 2 "arm_rhs_operand" "rI")))]
  1166.   ""
  1167.   "eor%?\\t%0, %1, %2")
  1168.  
  1169. (define_insn ""
  1170.   [(set (reg:CC_NOOV 24)
  1171.     (compare:CC_NOOV (xor:SI (match_operand:SI 1 "s_register_operand" "r")
  1172.                  (match_operand:SI 2 "arm_rhs_operand" "rI"))
  1173.              (const_int 0)))
  1174.    (set (match_operand:SI 0 "s_register_operand" "=r")
  1175.     (xor:SI (match_dup 1) (match_dup 2)))]
  1176.   ""
  1177.   "eor%?s\\t%0, %1, %2"
  1178. [(set_attr "conds" "set")])
  1179.  
  1180. (define_insn ""
  1181.   [(set (reg:CC_NOOV 24)
  1182.     (compare:CC_NOOV (xor:SI (match_operand:SI 0 "s_register_operand" "r")
  1183.                  (match_operand:SI 1 "arm_rhs_operand" "rI"))
  1184.              (const_int 0)))]
  1185.   ""
  1186.   "teq%?\\t%0, %1"
  1187. [(set_attr "conds" "set")])
  1188.  
  1189. ;; by splitting (IOR (AND (NOT A) (NOT B)) C) as D = AND (IOR A B) (NOT C), 
  1190. ;; (NOT D) we can sometimes merge the final NOT into one of the following
  1191. ;; insns
  1192.  
  1193. (define_split
  1194.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  1195.     (ior:SI (and:SI (not:SI (match_operand:SI 1 "s_register_operand" "r"))
  1196.             (not:SI (match_operand:SI 2 "arm_rhs_operand" "rI")))
  1197.         (match_operand:SI 3 "arm_rhs_operand" "rI")))
  1198.    (clobber (match_operand:SI 4 "s_register_operand" "=r"))]
  1199.   ""
  1200.   [(set (match_dup 4) (and:SI (ior:SI (match_dup 1) (match_dup 2))
  1201.                   (not:SI (match_dup 3))))
  1202.    (set (match_dup 0) (not:SI (match_dup 4)))]
  1203.   ""
  1204. )
  1205.  
  1206. (define_insn ""
  1207.   [(set (match_operand:SI 0 "s_register_operand" "=&r,&r,&r")
  1208.     (and:SI (ior:SI (match_operand:SI 1 "s_register_operand" "r,r,0")
  1209.             (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI"))
  1210.         (not:SI (match_operand:SI 3 "arm_rhs_operand" "rI,rI,rI"))))]
  1211.   ""
  1212.   "orr%?\\t%0, %1, %2\;bic%?\\t%0, %0, %3"
  1213. [(set_attr "length" "8")])
  1214.  
  1215.  
  1216.  
  1217. ;; Minimum and maximum insns
  1218.  
  1219. (define_insn "smaxsi3"
  1220.   [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
  1221.     (smax:SI (match_operand:SI 1 "s_register_operand" "0,r,?r")
  1222.          (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI")))
  1223.    (clobber (reg:CC 24))]
  1224.   ""
  1225.   "@
  1226.    cmp\\t%1, %2\;movlt\\t%0, %2
  1227.    cmp\\t%1, %2\;movge\\t%0, %1
  1228.    cmp\\t%1, %2\;movge\\t%0, %1\;movlt\\t%0, %2"
  1229. [(set_attr "conds" "clob")
  1230.  (set_attr "length" "8,8,12")])
  1231.  
  1232. (define_insn "sminsi3"
  1233.   [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
  1234.     (smin:SI (match_operand:SI 1 "s_register_operand" "0,r,?r")
  1235.          (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI")))
  1236.    (clobber (reg:CC 24))]
  1237.   ""
  1238.   "@
  1239.    cmp\\t%1, %2\;movge\\t%0, %2
  1240.    cmp\\t%1, %2\;movlt\\t%0, %1
  1241.    cmp\\t%1, %2\;movlt\\t%0, %1\;movge\\t%0, %2"
  1242. [(set_attr "conds" "clob")
  1243.  (set_attr "length" "8,8,12")])
  1244.  
  1245. (define_insn "umaxsi3"
  1246.   [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
  1247.     (umax:SI (match_operand:SI 1 "s_register_operand" "0,r,?r")
  1248.          (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI")))
  1249.    (clobber (reg:CC 24))]
  1250.   ""
  1251.   "@
  1252.    cmp\\t%1, %2\;movcc\\t%0, %2
  1253.    cmp\\t%1, %2\;movcs\\t%0, %1
  1254.    cmp\\t%1, %2\;movcs\\t%0, %1\;movcc\\t%0, %2"
  1255. [(set_attr "conds" "clob")
  1256.  (set_attr "length" "8,8,12")])
  1257.  
  1258. (define_insn "uminsi3"
  1259.   [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
  1260.     (umin:SI (match_operand:SI 1 "s_register_operand" "0,r,?r")
  1261.          (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI")))
  1262.    (clobber (reg:CC 24))]
  1263.   ""
  1264.   "@
  1265.    cmp\\t%1, %2\;movcs\\t%0, %2
  1266.    cmp\\t%1, %2\;movcc\\t%0, %1
  1267.    cmp\\t%1, %2\;movcc\\t%0, %1\;movcs\\t%0, %2"
  1268. [(set_attr "conds" "clob")
  1269.  (set_attr "length" "8,8,12")])
  1270.  
  1271. (define_insn ""
  1272.   [(set (match_operand:SI 0 "memory_operand" "=m")
  1273.     (match_operator:SI 3 "minmax_operator"
  1274.      [(match_operand:SI 1 "s_register_operand" "r")
  1275.       (match_operand:SI 2 "s_register_operand" "r")]))
  1276.    (clobber (reg:CC 24))]
  1277.   ""
  1278.   "*
  1279.   operands[3] = gen_rtx (minmax_code (operands[3]), SImode, operands[1],
  1280.              operands[2]);
  1281.   output_asm_insn (\"cmp\\t%1, %2\", operands);
  1282.   output_asm_insn (\"str%d3\\t%1, %0\", operands);
  1283.   output_asm_insn (\"str%D3\\t%2, %0\", operands);
  1284.   return \"\";
  1285. "
  1286. [(set_attr "conds" "clob")
  1287.  (set_attr "length" "12")
  1288.  (set_attr "type" "store1")])
  1289.  
  1290. (define_insn ""
  1291.   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
  1292.     (match_operator:SI 4 "shiftable_operator"
  1293.      [(match_operator:SI 5 "minmax_operator"
  1294.        [(match_operand:SI 2 "s_register_operand" "r,r")
  1295.         (match_operand:SI 3 "arm_rhs_operand" "rI,rI")])
  1296.       (match_operand:SI 1 "s_register_operand" "0,?r")]))
  1297.    (clobber (reg:CC 24))]
  1298.   ""
  1299.   "*
  1300. {
  1301.   enum rtx_code code = GET_CODE (operands[4]);
  1302.  
  1303.   operands[5] = gen_rtx (minmax_code (operands[5]), SImode, operands[2],
  1304.              operands[3]);
  1305.   output_asm_insn (\"cmp\\t%2, %3\", operands);
  1306.   output_asm_insn (\"%i4%d5\\t%0, %1, %2\", operands);
  1307.   if (which_alternative != 0 || operands[3] != const0_rtx
  1308.       || (code != PLUS && code != MINUS && code != IOR && code != XOR))
  1309.     output_asm_insn (\"%i4%D5\\t%0, %1, %3\", operands);
  1310.   return \"\";
  1311. }
  1312. "
  1313. [(set_attr "conds" "clob")
  1314.  (set_attr "length" "12")])
  1315.  
  1316.  
  1317. ;; Shift and rotation insns
  1318.  
  1319. (define_expand "ashlsi3"
  1320.   [(set (match_operand:SI 0 "s_register_operand" "")
  1321.     (ashift:SI (match_operand:SI 1 "s_register_operand" "")
  1322.            (match_operand:SI 2 "arm_rhs_operand" "")))]
  1323.   ""
  1324.   "
  1325.   if (GET_CODE (operands[2]) == CONST_INT
  1326.       && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) > 31)
  1327.     {
  1328.       emit_insn (gen_movsi (operands[0], const0_rtx));
  1329.       DONE;
  1330.     }
  1331. ")
  1332.  
  1333. (define_expand "ashrsi3"
  1334.   [(set (match_operand:SI 0 "s_register_operand" "")
  1335.     (ashiftrt:SI (match_operand:SI 1 "s_register_operand" "")
  1336.              (match_operand:SI 2 "arm_rhs_operand" "")))]
  1337.   ""
  1338.   "
  1339.   if (GET_CODE (operands[2]) == CONST_INT
  1340.       && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) > 31)
  1341.     operands[2] = GEN_INT (31);
  1342. ")
  1343.  
  1344. (define_expand "lshrsi3"
  1345.   [(set (match_operand:SI 0 "s_register_operand" "")
  1346.     (lshiftrt:SI (match_operand:SI 1 "s_register_operand" "")
  1347.              (match_operand:SI 2 "arm_rhs_operand" "")))]
  1348.   ""
  1349.   "
  1350.   if (GET_CODE (operands[2]) == CONST_INT
  1351.       && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) > 31)
  1352.     {
  1353.       emit_insn (gen_movsi (operands[0], const0_rtx));
  1354.       DONE;
  1355.     }
  1356. ")
  1357.  
  1358. (define_expand "rotlsi3"
  1359.   [(set (match_operand:SI 0 "s_register_operand" "")
  1360.     (rotatert:SI (match_operand:SI 1 "s_register_operand" "")
  1361.              (match_operand:SI 2 "reg_or_int_operand" "")))]
  1362.   ""
  1363.   "
  1364.   if (GET_CODE (operands[2]) == CONST_INT)
  1365.     operands[2] = GEN_INT ((32 - INTVAL (operands[2])) % 32);
  1366.   else
  1367.     {
  1368.       rtx reg = gen_reg_rtx (SImode);
  1369.       emit_insn (gen_subsi3 (reg, GEN_INT (32), operands[2]));
  1370.       operands[2] = reg;
  1371.     }
  1372. ")
  1373.  
  1374. (define_expand "rotrsi3"
  1375.   [(set (match_operand:SI 0 "s_register_operand" "")
  1376.     (rotatert:SI (match_operand:SI 1 "s_register_operand" "")
  1377.              (match_operand:SI 2 "arm_rhs_operand" "")))]
  1378.   ""
  1379.   "
  1380.   if (GET_CODE (operands[2]) == CONST_INT
  1381.       && ((unsigned HOST_WIDE_INT) INTVAL (operands[2])) > 31)
  1382.     operands[2] = GEN_INT (INTVAL (operands[2]) % 32);
  1383. ")
  1384.  
  1385. (define_insn ""
  1386.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  1387.     (match_operator:SI 3 "shift_operator"
  1388.      [(match_operand:SI 1 "s_register_operand" "r")
  1389.       (match_operand:SI 2 "reg_or_int_operand" "rM")]))]
  1390.   ""
  1391.   "mov%?\\t%0, %1%S3")
  1392.  
  1393. (define_insn ""
  1394.   [(set (reg:CC_NOOV 24)
  1395.     (compare:CC_NOOV (match_operator:SI 3 "shift_operator"
  1396.               [(match_operand:SI 1 "s_register_operand" "r")
  1397.                (match_operand:SI 2 "arm_rhs_operand" "rM")])
  1398.              (const_int 0)))
  1399.    (set (match_operand:SI 0 "s_register_operand" "=r")
  1400.     (match_op_dup 3 [(match_dup 1) (match_dup 2)]))]
  1401.   ""
  1402.   "mov%?s\\t%0, %1%S3"
  1403. [(set_attr "conds" "set")])
  1404.  
  1405. (define_insn ""
  1406.   [(set (reg:CC_NOOV 24)
  1407.     (compare:CC_NOOV (match_operator:SI 3 "shift_operator"
  1408.               [(match_operand:SI 1 "s_register_operand" "r")
  1409.                (match_operand:SI 2 "arm_rhs_operand" "rM")])
  1410.              (const_int 0)))
  1411.    (clobber (match_scratch:SI 0 "=r"))]
  1412.   ""
  1413.   "mov%?s\\t%0, %1%S3"
  1414. [(set_attr "conds" "set")])
  1415.  
  1416. (define_insn ""
  1417.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  1418.     (not:SI (match_operator:SI 3 "shift_operator"
  1419.          [(match_operand:SI 1 "s_register_operand" "r")
  1420.           (match_operand:SI 2 "arm_rhs_operand" "rM")])))]
  1421.   ""
  1422.   "mvn%?\\t%0, %1%S3")
  1423.  
  1424. (define_insn ""
  1425.   [(set (reg:CC_NOOV 24)
  1426.     (compare:CC_NOOV (not:SI (match_operator:SI 3 "shift_operator"
  1427.               [(match_operand:SI 1 "s_register_operand" "r")
  1428.                (match_operand:SI 2 "arm_rhs_operand" "rM")]))
  1429.              (const_int 0)))
  1430.    (set (match_operand:SI 0 "s_register_operand" "=r")
  1431.     (not:SI (match_op_dup 3 [(match_dup 1) (match_dup 2)])))]
  1432.   ""
  1433.   "mvn%?s\\t%0, %1%S3"
  1434. [(set_attr "conds" "set")])
  1435.  
  1436. (define_insn ""
  1437.   [(set (reg:CC_NOOV 24)
  1438.     (compare:CC_NOOV (not:SI (match_operator:SI 3 "shift_operator"
  1439.               [(match_operand:SI 1 "s_register_operand" "r")
  1440.                (match_operand:SI 2 "arm_rhs_operand" "rM")]))
  1441.              (const_int 0)))
  1442.    (clobber (match_scratch:SI 0 "=r"))]
  1443.   ""
  1444.   "mvn%?s\\t%0, %1%S3"
  1445. [(set_attr "conds" "set")])
  1446.  
  1447.  
  1448. ;; Unary arithmetic insns
  1449.  
  1450. (define_insn "negdi2"
  1451.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
  1452.     (neg:DI (match_operand:DI 1 "s_register_operand" "?r,0")))]
  1453.   ""
  1454.   "rsbs\\t%0, %1, #0\;rsc\\t%R0, %R1, #0"
  1455. [(set_attr "conds" "clob")
  1456.  (set_attr "length" "8")])
  1457.  
  1458. (define_insn "negsi2"
  1459.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  1460.     (neg:SI (match_operand:SI 1 "s_register_operand" "r")))]
  1461.   ""
  1462.   "rsb%?\\t%0, %1, #0")
  1463.  
  1464. (define_insn "negsf2"
  1465.   [(set (match_operand:SF 0 "s_register_operand" "=f")
  1466.     (neg:SF (match_operand:SF 1 "s_register_operand" "f")))]
  1467.   "TARGET_HARD_FLOAT"
  1468.   "mnf%?s\\t%0, %1"
  1469. [(set_attr "type" "ffarith")])
  1470.  
  1471. (define_insn "negdf2"
  1472.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  1473.     (neg:DF (match_operand:DF 1 "s_register_operand" "f")))]
  1474.   "TARGET_HARD_FLOAT"
  1475.   "mnf%?d\\t%0, %1"
  1476. [(set_attr "type" "ffarith")])
  1477.  
  1478. (define_insn ""
  1479.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  1480.     (neg:DF (float_extend:DF
  1481.          (match_operand:SF 1 "s_register_operand" "f"))))]
  1482.   "TARGET_HARD_FLOAT"
  1483.   "mnf%?d\\t%0, %1"
  1484. [(set_attr "type" "ffarith")])
  1485.  
  1486. (define_insn "negxf2"
  1487.   [(set (match_operand:XF 0 "s_register_operand" "=f")
  1488.     (neg:XF (match_operand:XF 1 "s_register_operand" "f")))]
  1489.   "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
  1490.   "mnf%?e\\t%0, %1"
  1491. [(set_attr "type" "ffarith")])
  1492.  
  1493. ;; abssi2 doesn't really clobber the condition codes if a different register
  1494. ;; is being set.  To keep things simple, assume during rtl manipulations that
  1495. ;; it does, but tell the final scan operator the truth.  Similarly for
  1496. ;; (neg (abs...))
  1497.  
  1498. (define_insn "abssi2"
  1499.   [(set (match_operand:SI 0 "s_register_operand" "=r,&r")
  1500.     (abs:SI (match_operand:SI 1 "s_register_operand" "0,r")))
  1501.    (clobber (reg 24))]
  1502.   ""
  1503.   "@
  1504.    cmp\\t%0, #0\;rsblt\\t%0, %0, #0
  1505.    eor%?\\t%0, %1, %1, asr #31\;sub%?\\t%0, %0, %1, asr #31"
  1506. [(set_attr "conds" "clob,*")
  1507.  (set_attr "length" "8")])
  1508.  
  1509. (define_insn ""
  1510.   [(set (match_operand:SI 0 "s_register_operand" "=r,&r")
  1511.     (neg:SI (abs:SI (match_operand:SI 1 "s_register_operand" "0,r"))))
  1512.    (clobber (reg 24))]
  1513.   ""
  1514.   "@
  1515.    cmp\\t%0, #0\;rsbgt\\t%0, %0, #0
  1516.    eor%?\\t%0, %1, %1, asr #31\;rsb%?\\t%0, %0, %1, asr #31"
  1517. [(set_attr "conds" "clob,*")
  1518.  (set_attr "length" "8")])
  1519.  
  1520. (define_insn "abssf2"
  1521.   [(set (match_operand:SF 0 "s_register_operand" "=f")
  1522.      (abs:SF (match_operand:SF 1 "s_register_operand" "f")))]
  1523.   "TARGET_HARD_FLOAT"
  1524.   "abs%?s\\t%0, %1"
  1525. [(set_attr "type" "ffarith")])
  1526.  
  1527. (define_insn "absdf2"
  1528.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  1529.     (abs:DF (match_operand:DF 1 "s_register_operand" "f")))]
  1530.   "TARGET_HARD_FLOAT"
  1531.   "abs%?d\\t%0, %1"
  1532. [(set_attr "type" "ffarith")])
  1533.  
  1534. (define_insn ""
  1535.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  1536.     (abs:DF (float_extend:DF
  1537.          (match_operand:SF 1 "s_register_operand" "f"))))]
  1538.   "TARGET_HARD_FLOAT"
  1539.   "abs%?d\\t%0, %1"
  1540. [(set_attr "type" "ffarith")])
  1541.  
  1542. (define_insn "absxf2"
  1543.   [(set (match_operand:XF 0 "s_register_operand" "=f")
  1544.     (abs:XF (match_operand:XF 1 "s_register_operand" "f")))]
  1545.   "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
  1546.   "abs%?e\\t%0, %1"
  1547. [(set_attr "type" "ffarith")])
  1548.  
  1549. (define_insn "sqrtsf2"
  1550.   [(set (match_operand:SF 0 "s_register_operand" "=f")
  1551.     (sqrt:SF (match_operand:SF 1 "s_register_operand" "f")))]
  1552.   "TARGET_HARD_FLOAT"
  1553.   "sqt%?s\\t%0, %1"
  1554. [(set_attr "type" "float_em")])
  1555.  
  1556. (define_insn "sqrtdf2"
  1557.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  1558.     (sqrt:DF (match_operand:DF 1 "s_register_operand" "f")))]
  1559.   "TARGET_HARD_FLOAT"
  1560.   "sqt%?d\\t%0, %1"
  1561. [(set_attr "type" "float_em")])
  1562.  
  1563. (define_insn ""
  1564.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  1565.     (sqrt:DF (float_extend:DF
  1566.           (match_operand:SF 1 "s_register_operand" "f"))))]
  1567.   "TARGET_HARD_FLOAT"
  1568.   "sqt%?d\\t%0, %1"
  1569. [(set_attr "type" "float_em")])
  1570.  
  1571. (define_insn "sqrtxf2"
  1572.   [(set (match_operand:XF 0 "s_register_operand" "=f")
  1573.     (sqrt:XF (match_operand:XF 1 "s_register_operand" "f")))]
  1574.   "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
  1575.   "sqt%?e\\t%0, %1"
  1576. [(set_attr "type" "float_em")])
  1577.  
  1578. (define_insn "sinsf2"
  1579.   [(set (match_operand:SF 0 "s_register_operand" "=f")
  1580.     (unspec:SF [(match_operand:SF 1 "s_register_operand" "f")] 0))]
  1581.   "TARGET_HARD_FLOAT"
  1582.   "sin%?s\\t%0, %1"
  1583. [(set_attr "type" "float_em")])
  1584.  
  1585. (define_insn "sindf2"
  1586.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  1587.     (unspec:DF [(match_operand:DF 1 "s_register_operand" "f")] 0))]
  1588.   "TARGET_HARD_FLOAT"
  1589.   "sin%?d\\t%0, %1"
  1590. [(set_attr "type" "float_em")])
  1591.  
  1592. (define_insn ""
  1593.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  1594.     (unspec:DF [(float_extend:DF
  1595.              (match_operand:SF 1 "s_register_operand" "f"))] 0))]
  1596.   "TARGET_HARD_FLOAT"
  1597.   "sin%?d\\t%0, %1"
  1598. [(set_attr "type" "float_em")])
  1599.  
  1600. (define_insn "sinxf2"
  1601.   [(set (match_operand:XF 0 "s_register_operand" "=f")
  1602.     (unspec:XF [(match_operand:XF 1 "s_register_operand" "f")] 0))]
  1603.   "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
  1604.   "sin%?e\\t%0, %1"
  1605. [(set_attr "type" "float_em")])
  1606.  
  1607. (define_insn "cossf2"
  1608.   [(set (match_operand:SF 0 "s_register_operand" "=f")
  1609.     (unspec:SF [(match_operand:SF 1 "s_register_operand" "f")] 1))]
  1610.   "TARGET_HARD_FLOAT"
  1611.   "cos%?s\\t%0, %1"
  1612. [(set_attr "type" "float_em")])
  1613.  
  1614. (define_insn "cosdf2"
  1615.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  1616.     (unspec:DF [(match_operand:DF 1 "s_register_operand" "f")] 1))]
  1617.   "TARGET_HARD_FLOAT"
  1618.   "cos%?d\\t%0, %1"
  1619. [(set_attr "type" "float_em")])
  1620.  
  1621. (define_insn ""
  1622.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  1623.     (unspec:DF [(float_extend:DF
  1624.              (match_operand:SF 1 "s_register_operand" "f"))] 1))]
  1625.   "TARGET_HARD_FLOAT"
  1626.   "cos%?d\\t%0, %1"
  1627. [(set_attr "type" "float_em")])
  1628.  
  1629. (define_insn "cosxf2"
  1630.   [(set (match_operand:XF 0 "s_register_operand" "=f")
  1631.     (unspec:XF [(match_operand:XF 1 "s_register_operand" "f")] 1))]
  1632.   "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
  1633.   "cos%?e\\t%0, %1"
  1634. [(set_attr "type" "float_em")])
  1635.  
  1636. (define_insn "one_cmpldi2"
  1637.   [(set (match_operand:DI 0 "s_register_operand" "=&r,&r")
  1638.     (not:DI (match_operand:DI 1 "s_register_operand" "?r,0")))]
  1639.   ""
  1640.   "mvn%?\\t%0, %1\;mvn%?\\t%R0, %R1"
  1641. [(set_attr "length" "8")])
  1642.  
  1643. (define_insn "one_cmplsi2"
  1644.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  1645.     (not:SI (match_operand:SI 1 "s_register_operand" "r")))]
  1646.   ""
  1647.   "mvn%?\\t%0, %1")
  1648.  
  1649. (define_insn ""
  1650.   [(set (reg:CC_NOOV 24)
  1651.     (compare:CC_NOOV (not:SI (match_operand:SI 1 "s_register_operand" "r"))
  1652.              (const_int 0)))
  1653.    (set (match_operand:SI 0 "s_register_operand" "=r")
  1654.     (not:SI (match_dup 1)))]
  1655.   ""
  1656.   "mvn%?s\\t%0, %1"
  1657. [(set_attr "conds" "set")])
  1658.  
  1659. (define_insn ""
  1660.   [(set (reg:CC_NOOV 24)
  1661.     (compare:CC_NOOV (not:SI (match_operand:SI 1 "s_register_operand" "r"))
  1662.              (const_int 0)))
  1663.    (clobber (match_scratch:SI 0 "=r"))]
  1664.   ""
  1665.   "mvn%?s\\t%0, %1"
  1666. [(set_attr "conds" "set")])
  1667.  
  1668. ;; Fixed <--> Floating conversion insns
  1669.  
  1670. (define_insn "floatsisf2"
  1671.   [(set (match_operand:SF 0 "s_register_operand" "=f")
  1672.     (float:SF (match_operand:SI 1 "s_register_operand" "r")))]
  1673.   "TARGET_HARD_FLOAT"
  1674.   "flt%?s\\t%0, %1"
  1675. [(set_attr "type" "r_2_f")])
  1676.  
  1677. (define_insn "floatsidf2"
  1678.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  1679.     (float:DF (match_operand:SI 1 "s_register_operand" "r")))]
  1680.   "TARGET_HARD_FLOAT"
  1681.   "flt%?d\\t%0, %1"
  1682. [(set_attr "type" "r_2_f")])
  1683.  
  1684. (define_insn "floatsixf2"
  1685.   [(set (match_operand:XF 0 "s_register_operand" "=f")
  1686.     (float:XF (match_operand:SI 1 "s_register_operand" "r")))]
  1687.   "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
  1688.   "flt%?e\\t%0, %1"
  1689. [(set_attr "type" "r_2_f")])
  1690.  
  1691. (define_insn "fix_truncsfsi2"
  1692.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  1693.     (fix:SI (match_operand:SF 1 "s_register_operand" "f")))]
  1694.   "TARGET_HARD_FLOAT"
  1695.   "fix%?z\\t%0, %1"
  1696. [(set_attr "type" "f_2_r")])
  1697.  
  1698. (define_insn "fix_truncdfsi2"
  1699.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  1700.     (fix:SI (match_operand:DF 1 "s_register_operand" "f")))]
  1701.   "TARGET_HARD_FLOAT"
  1702.   "fix%?z\\t%0, %1"
  1703. [(set_attr "type" "f_2_r")])
  1704.  
  1705. (define_insn "fix_truncxfsi2"
  1706.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  1707.     (fix:SI (match_operand:XF 1 "s_register_operand" "f")))]
  1708.   "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
  1709.   "fix%?z\\t%0, %1"
  1710. [(set_attr "type" "f_2_r")])
  1711.  
  1712. ;; Truncation insns
  1713.  
  1714. (define_insn "truncdfsf2"
  1715.   [(set (match_operand:SF 0 "s_register_operand" "=f")
  1716.     (float_truncate:SF
  1717.      (match_operand:DF 1 "s_register_operand" "f")))]
  1718.   "TARGET_HARD_FLOAT"
  1719.   "mvf%?s\\t%0, %1"
  1720. [(set_attr "type" "ffarith")])
  1721.  
  1722. (define_insn "truncxfsf2"
  1723.   [(set (match_operand:SF 0 "s_register_operand" "=f")
  1724.     (float_truncate:SF
  1725.      (match_operand:XF 1 "s_register_operand" "f")))]
  1726.   "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
  1727.   "mvf%?s\\t%0, %1"
  1728. [(set_attr "type" "ffarith")])
  1729.  
  1730. (define_insn "truncxfdf2"
  1731.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  1732.     (float_truncate:DF
  1733.      (match_operand:XF 1 "s_register_operand" "f")))]
  1734.   "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
  1735.   "mvf%?d\\t%0, %1"
  1736. [(set_attr "type" "ffarith")])
  1737.  
  1738. ;; Zero and sign extension instructions.
  1739.  
  1740. (define_insn "zero_extendsidi2"
  1741.   [(set (match_operand:DI 0 "s_register_operand" "=r")
  1742.         (zero_extend:DI (match_operand:SI 1 "s_register_operand" "r")))]
  1743.   ""
  1744.   "*
  1745.   if (REGNO (operands[1]) != REGNO (operands[0]))
  1746.     output_asm_insn (\"mov%?\\t%0, %1\", operands);
  1747.   return \"mov%?\\t%R0, #0\";
  1748. "
  1749. [(set_attr "length" "8")])
  1750.  
  1751. (define_insn "zero_extendqidi2"
  1752.   [(set (match_operand:DI 0 "s_register_operand" "=r,r")
  1753.     (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
  1754.   ""
  1755.   "@
  1756.    and%?\\t%0, %1, #255\;mov%?\\t%R0, #0
  1757.    ldr%?b\\t%0, %1\;mov%?\\t%R0, #0"
  1758. [(set_attr "length" "8")
  1759.  (set_attr "type" "*,load")])
  1760.  
  1761. (define_insn "extendsidi2"
  1762.   [(set (match_operand:DI 0 "s_register_operand" "=r")
  1763.         (sign_extend:DI (match_operand:SI 1 "s_register_operand" "r")))]
  1764.   ""
  1765.   "*
  1766.   if (REGNO (operands[1]) != REGNO (operands[0]))
  1767.     output_asm_insn (\"mov%?\\t%0, %1\", operands);
  1768.   return \"mov%?\\t%R0, %0, asr #31\";
  1769. "
  1770. [(set_attr "length" "8")])
  1771.  
  1772. (define_expand "zero_extendhisi2"
  1773.   [(set (match_dup 2) (ashift:SI (match_operand:HI 1 "nonimmediate_operand" "")
  1774.                  (const_int 16)))
  1775.    (set (match_operand:SI 0 "s_register_operand" "")
  1776.     (lshiftrt:SI (match_dup 2) (const_int 16)))]
  1777.   ""
  1778.   "
  1779. {
  1780.   if (TARGET_SHORT_BY_BYTES && GET_CODE (operands[1]) == MEM)
  1781.     {
  1782.       emit_insn (gen_movhi_bytes (operands[0], operands[1]));
  1783.       DONE;
  1784.     }
  1785.   if (! s_register_operand (operands[1], HImode))
  1786.     operands[1] = copy_to_mode_reg (HImode, operands[1]);
  1787.   operands[1] = gen_lowpart (SImode, operands[1]);
  1788.   operands[2] = gen_reg_rtx (SImode); 
  1789. }")
  1790.  
  1791. (define_expand "zero_extendqisi2"
  1792.   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
  1793.     (zero_extend:SI
  1794.      (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
  1795.   ""
  1796.   "
  1797.   if (GET_CODE (operands[1]) != MEM)
  1798.     {
  1799.       emit_insn (gen_andsi3 (operands[0], gen_lowpart (SImode, operands[1]),
  1800.                  GEN_INT (255)));
  1801.       DONE;
  1802.     }
  1803. ")
  1804.  
  1805. (define_insn ""
  1806.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  1807.     (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
  1808.   ""
  1809.   "ldr%?b\\t%0, %1\\t%@ zero_extendqisi2"
  1810. [(set_attr "type" "load")])
  1811.  
  1812. (define_split
  1813.   [(set (match_operand:SI 0 "s_register_operand" "")
  1814.     (zero_extend:SI (subreg:QI (match_operand:SI 1 "" "") 0)))
  1815.    (clobber (match_operand:SI 2 "s_register_operand" ""))]
  1816.   "GET_CODE (operands[1]) != MEM"
  1817.   [(set (match_dup 2) (match_dup 1))
  1818.    (set (match_dup 0) (and:SI (match_dup 2) (const_int 255)))]
  1819.   "")
  1820.  
  1821. (define_insn ""
  1822.   [(set (reg:CC_NOOV 24)
  1823.     (compare:CC_NOOV (match_operand:QI 0 "s_register_operand" "r")
  1824.              (const_int 0)))]
  1825.   ""
  1826.   "tst\\t%0, #255"
  1827. [(set_attr "conds" "set")])
  1828.  
  1829. (define_expand "extendhisi2"
  1830.   [(set (match_dup 2)
  1831.     (ashift:SI (match_operand:HI 1 "nonimmediate_operand" "")
  1832.            (const_int 16)))
  1833.    (set (match_operand:SI 0 "s_register_operand" "")
  1834.     (ashiftrt:SI (match_dup 2)
  1835.              (const_int 16)))]
  1836.   ""
  1837.   "
  1838.   if (TARGET_SHORT_BY_BYTES && GET_CODE (operands[1]) == MEM)
  1839.     {
  1840.       emit_insn (gen_extendhisi2_mem (operands[0], operands[1]));
  1841.       DONE;
  1842.     }
  1843.   if (! s_register_operand (operands[1], HImode))
  1844.     operands[1] = copy_to_mode_reg (HImode, operands[1]);
  1845.   operands[1] = gen_lowpart (SImode, operands[1]);
  1846.   operands[2] = gen_reg_rtx (SImode);
  1847. }")
  1848.  
  1849. (define_expand "extendhisi2_mem"
  1850.   [(set (match_dup 2) (zero_extend:SI (mem:QI (match_operand:HI 1 "" ""))))
  1851.    (set (match_dup 3)
  1852.     (zero_extend:SI (mem:QI (plus:SI (match_dup 1) (const_int 1)))))
  1853.    (set (match_dup 6) (ashift:SI (match_dup 4) (const_int 24)))
  1854.    (set (match_operand:SI 0 "" "")
  1855.     (ior:SI (ashiftrt:SI (match_dup 6) (const_int 16)) (match_dup 5)))]
  1856.   ""
  1857.   "
  1858.   operands[0] = gen_lowpart (SImode, operands[0]);
  1859.   operands[1] = copy_to_mode_reg (SImode, XEXP (operands[1], 0));
  1860.   operands[2] = gen_reg_rtx (SImode);
  1861.   operands[3] = gen_reg_rtx (SImode);
  1862.   operands[6] = gen_reg_rtx (SImode);
  1863.  
  1864.   if (BYTES_BIG_ENDIAN)
  1865.     {
  1866.       operands[4] = operands[2];
  1867.       operands[5] = operands[3];
  1868.     }
  1869.   else
  1870.     {
  1871.       operands[4] = operands[3];
  1872.       operands[5] = operands[2];
  1873.     }
  1874. ")
  1875.  
  1876. (define_expand "extendqihi2"
  1877.   [(set (match_dup 2)
  1878.     (ashift:SI (match_operand:QI 1 "s_register_operand" "")
  1879.            (const_int 24)))
  1880.    (set (match_operand:HI 0 "s_register_operand" "")
  1881.     (ashiftrt:SI (match_dup 2)
  1882.              (const_int 24)))]
  1883.   ""
  1884.   "
  1885. { operands[0] = gen_lowpart (SImode, operands[0]);
  1886.   operands[1] = gen_lowpart (SImode, operands[1]);
  1887.   operands[2] = gen_reg_rtx (SImode); }")
  1888.  
  1889. (define_expand "extendqisi2"
  1890.   [(set (match_dup 2)
  1891.     (ashift:SI (match_operand:QI 1 "s_register_operand" "")
  1892.            (const_int 24)))
  1893.    (set (match_operand:SI 0 "s_register_operand" "")
  1894.     (ashiftrt:SI (match_dup 2)
  1895.              (const_int 24)))]
  1896.   ""
  1897.   "
  1898. { operands[1] = gen_lowpart (SImode, operands[1]);
  1899.   operands[2] = gen_reg_rtx (SImode); }")
  1900.  
  1901. (define_insn "extendsfdf2"
  1902.   [(set (match_operand:DF 0 "s_register_operand" "=f")
  1903.     (float_extend:DF (match_operand:SF 1 "s_register_operand" "f")))]
  1904.   "TARGET_HARD_FLOAT"
  1905.   "mvf%?d\\t%0, %1"
  1906. [(set_attr "type" "ffarith")])
  1907.  
  1908. (define_insn "extendsfxf2"
  1909.   [(set (match_operand:XF 0 "s_register_operand" "=f")
  1910.     (float_extend:XF (match_operand:SF 1 "s_register_operand" "f")))]
  1911.   "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
  1912.   "mvf%?e\\t%0, %1"
  1913. [(set_attr "type" "ffarith")])
  1914.  
  1915. (define_insn "extenddfxf2"
  1916.   [(set (match_operand:XF 0 "s_register_operand" "=f")
  1917.     (float_extend:XF (match_operand:DF 1 "s_register_operand" "f")))]
  1918.   "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
  1919.   "mvf%?e\\t%0, %1"
  1920. [(set_attr "type" "ffarith")])
  1921.  
  1922.  
  1923. ;; Move insns (including loads and stores)
  1924.  
  1925. ;; XXX Just some ideas about movti.
  1926. ;; I don't think these are a good idea on the arm, there just aren't enough
  1927. ;; registers
  1928. ;;(define_expand "loadti"
  1929. ;;  [(set (match_operand:TI 0 "s_register_operand" "")
  1930. ;;    (mem:TI (match_operand:SI 1 "address_operand" "")))]
  1931. ;;  "" "")
  1932.  
  1933. ;;(define_expand "storeti"
  1934. ;;  [(set (mem:TI (match_operand:TI 0 "address_operand" ""))
  1935. ;;    (match_operand:TI 1 "s_register_operand" ""))]
  1936. ;;  "" "")
  1937.  
  1938. ;;(define_expand "movti"
  1939. ;;  [(set (match_operand:TI 0 "general_operand" "")
  1940. ;;    (match_operand:TI 1 "general_operand" ""))]
  1941. ;;  ""
  1942. ;;  "
  1943. ;;{
  1944. ;;  rtx insn;
  1945. ;;
  1946. ;;  if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
  1947. ;;    operands[1] = copy_to_reg (operands[1]);
  1948. ;;  if (GET_CODE (operands[0]) == MEM)
  1949. ;;    insn = gen_storeti (XEXP (operands[0], 0), operands[1]);
  1950. ;;  else if (GET_CODE (operands[1]) == MEM)
  1951. ;;    insn = gen_loadti (operands[0], XEXP (operands[1], 0));
  1952. ;;  else
  1953. ;;    FAIL;
  1954. ;;
  1955. ;;  emit_insn (insn);
  1956. ;;  DONE;
  1957. ;;}")
  1958.  
  1959. ;; Recognise garbage generated above.
  1960.  
  1961. ;;(define_insn ""
  1962. ;;  [(set (match_operand:TI 0 "general_operand" "=r,r,r,<,>,m")
  1963. ;;    (match_operand:TI 1 "general_operand" "<,>,m,r,r,r"))]
  1964. ;;  ""
  1965. ;;  "*
  1966. ;;  {
  1967. ;;    register mem = (which_alternative < 3);
  1968. ;;    register char *template;
  1969. ;;
  1970. ;;    operands[mem] = XEXP (operands[mem], 0);
  1971. ;;    switch (which_alternative)
  1972. ;;      {
  1973. ;;      case 0: template = \"ldmdb\\t%1!, %M0\"; break;
  1974. ;;      case 1: template = \"ldmia\\t%1!, %M0\"; break;
  1975. ;;      case 2: template = \"ldmia\\t%1, %M0\"; break;
  1976. ;;      case 3: template = \"stmdb\\t%0!, %M1\"; break;
  1977. ;;      case 4: template = \"stmia\\t%0!, %M1\"; break;
  1978. ;;      case 5: template = \"stmia\\t%0, %M1\"; break;
  1979. ;;      }
  1980. ;;    output_asm_insn (template, operands);
  1981. ;;    return \"\";
  1982. ;;  }")
  1983.  
  1984.  
  1985. (define_insn "movdi"
  1986.   [(set (match_operand:DI 0 "di_operand" "=r,r,r,o<>,r")
  1987.     (match_operand:DI 1 "di_operand" "rIK,n,o<>,r,F"))]
  1988.   ""
  1989.   "*
  1990.   return (output_move_double (operands));
  1991. "
  1992. [(set_attr "length" "8,32,8,8,32")
  1993.  (set_attr "type" "*,*,load,store2,*")])
  1994.  
  1995. (define_expand "movsi"
  1996.   [(set (match_operand:SI 0 "general_operand" "")
  1997.         (match_operand:SI 1 "general_operand" ""))]
  1998.   ""
  1999.   "
  2000.   /* Everything except mem = const or mem = mem can be done easily */
  2001.   if (GET_CODE (operands[0]) == MEM)
  2002.     operands[1] = force_reg (SImode, operands[1]);
  2003.   if (GET_CODE (operands[1]) == CONST_INT
  2004.       && !(const_ok_for_arm (INTVAL (operands[1]))
  2005.            || const_ok_for_arm (~INTVAL (operands[1]))))
  2006.     {
  2007.       arm_split_constant (SET, SImode, INTVAL (operands[1]), operands[0],
  2008.               NULL_RTX,
  2009.               (reload_in_progress || reload_completed ? 0
  2010.                : preserve_subexpressions_p ()));
  2011.       DONE;
  2012.     }
  2013. ")
  2014.  
  2015. (define_insn ""
  2016.   [(set (match_operand:SI 0 "general_operand" "=r,r,r,r,m,r,r")
  2017.     (match_operand:SI 1 "general_operand"  "R,m,K,rI,r,S,?n"))]
  2018.   "(register_operand (operands[0], SImode)
  2019.     && (GET_CODE (operands[1]) != SYMBOL_REF
  2020.     || CONSTANT_ADDRESS_P (operands[1])))
  2021.    || register_operand (operands[1], SImode)"
  2022.   "*
  2023.   switch (which_alternative)
  2024.     {
  2025.     case 0:
  2026.       /* NB Calling get_attr_length may cause the insn to be re-extracted... */
  2027.       if (get_attr_length (insn) == 8)
  2028.     {
  2029.       /* ... so modify the operands here.  */
  2030.       operands[1] = XEXP (operands[1], 0);
  2031.       output_asm_insn (\"sub%?\\t%0, %|pc, #(8 + . - %a1) & ~4095\",
  2032.                operands);
  2033.       output_asm_insn (\"ldr%?\\t%0, [%0, #- ((4 + . - %a1) & 4095)]\",
  2034.                operands);
  2035.     }
  2036.       else
  2037.     {
  2038.       /* ... and here.  */
  2039.       operands[1] = XEXP (operands[1], 0);
  2040.       output_asm_insn (\"ldr%?\\t%0, [%|pc, %1 - . - 8]\", operands);
  2041.     }
  2042.       return \"\";
  2043.  
  2044.     case 1:
  2045.       if (GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
  2046.       &&  CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0)))
  2047.     abort ();
  2048.       return \"ldr%?\\t%0, %1\";
  2049.  
  2050.     case 3:
  2051.       return \"mov%?\\t%0, %1\";
  2052.     case 2:
  2053.       return \"mvn%?\\t%0, #%B1\";
  2054.     case 4:
  2055.       return \"str%?\\t%1, %0\";
  2056.     case 5:
  2057.       return output_load_symbol (insn, operands);
  2058.     case 6:
  2059.       return \"#\";
  2060.     }
  2061. "
  2062. [(set (attr "length")
  2063.       (cond [(eq_attr "alternative" "0")
  2064.              (if_then_else
  2065.               (gt (minus 
  2066.                    (pc)
  2067.                    (symbol_ref "const_pool_offset (XEXP (operands[1], 0))"))
  2068.                   (const_int 4087))
  2069.               (const_int 8)
  2070.               (const_int 4))
  2071.              (ior (eq_attr "alternative" "5")
  2072.           (eq_attr "alternative" "6")) (const_int 16)]
  2073.             (const_int 4)))
  2074.  (set_attr "type" "load,load,*,*,store1,*,*")])
  2075.  
  2076. (define_split
  2077.   [(set (match_operand:SI 0 "s_register_operand" "")
  2078.     (match_operand:SI 1 "const_int_operand" ""))]
  2079.   "! (const_ok_for_arm (INTVAL (operands[1]))
  2080.       || const_ok_for_arm (~INTVAL (operands[1])))"
  2081.   [(clobber (const_int 0))]
  2082.   "
  2083.   arm_split_constant (SET, SImode, INTVAL (operands[1]), operands[0],
  2084.               NULL_RTX, 0);
  2085.   DONE;
  2086. ")
  2087.  
  2088. ;; If copying one reg to another we can set the condition codes according to
  2089. ;; its value.  Such a move is common after a return from subroutine and the
  2090. ;; result is being tested against zero.
  2091.  
  2092. (define_insn ""
  2093.   [(set (reg:CC 24) (compare (match_operand:SI 1 "s_register_operand" "0,r")
  2094.                  (const_int 0)))
  2095.    (set (match_operand:SI 0 "s_register_operand" "=r,r") (match_dup 1))]
  2096.   ""
  2097.   "@
  2098.    cmp%?\\t%0, #0
  2099.    sub%?s\\t%0, %1, #0"
  2100. [(set_attr "conds" "set")])
  2101.  
  2102. ;; Subroutine to store a half word from a register into memory.
  2103. ;; Operand 0 is the source register (HImode)
  2104. ;; Operand 1 is the destination address in a register (SImode)
  2105.  
  2106. ;; In both this routine and the next, we must be careful not to spill
  2107. ;; a memory address of reg+large_const into a separate PLUS insn, since this
  2108. ;; can generate unrecognizable rtl.
  2109.  
  2110. (define_expand "storehi"
  2111.   [;; store the low byte
  2112.    (set (mem:QI (match_operand:SI 1 "" "")) (match_dup 3))
  2113.    ;; extract the high byte
  2114.    (set (match_dup 2)
  2115.     (ashiftrt:SI (match_operand 0 "" "") (const_int 8)))
  2116.    ;; store the high byte
  2117.    (set (mem:QI (match_dup 4))
  2118.     (subreg:QI (match_dup 2) 0))]    ;explicit subreg safe
  2119.   ""
  2120.   "
  2121. {
  2122.   enum rtx_code code = GET_CODE (operands[1]);
  2123.  
  2124.   if ((code == PLUS || code == MINUS)
  2125.       && (GET_CODE (XEXP (operands[1], 1)) == REG
  2126.       || GET_CODE (XEXP (operands[1], 0)) != REG))
  2127.     operands[1] = force_reg (SImode, operands[1]);
  2128.   operands[4] = plus_constant (operands[1], 1);
  2129.   operands[3] = gen_lowpart (QImode, operands[0]);
  2130.   operands[0] = gen_lowpart (SImode, operands[0]);
  2131.   operands[2] = gen_reg_rtx (SImode); 
  2132. }
  2133. ")
  2134.  
  2135. (define_expand "storehi_bigend"
  2136.   [(set (mem:QI (match_dup 4)) (match_dup 3))
  2137.    (set (match_dup 2)
  2138.     (ashiftrt:SI (match_operand 0 "" "") (const_int 8)))
  2139.    (set (mem:QI (match_operand 1 "" ""))
  2140.     (subreg:QI (match_dup 2) 0))]
  2141.   ""
  2142.   "
  2143. {
  2144.   enum rtx_code code = GET_CODE (operands[1]);
  2145.   if ((code == PLUS || code == MINUS)
  2146.       && (GET_CODE (XEXP (operands[1], 1)) == REG
  2147.       || GET_CODE (XEXP (operands[1], 0)) != REG))
  2148.     operands[1] = force_reg (SImode, operands[1]);
  2149.  
  2150.   operands[4] = plus_constant (operands[1], 1);
  2151.   operands[3] = gen_lowpart (QImode, operands[0]);
  2152.   operands[0] = gen_lowpart (SImode, operands[0]);
  2153.   operands[2] = gen_reg_rtx (SImode);
  2154. }
  2155. ")
  2156.  
  2157. ;; Subroutine to store a half word integer constant into memory.
  2158. (define_expand "storeinthi"
  2159.   [(set (mem:QI (match_operand:SI 0 "" ""))
  2160.     (subreg:QI (match_operand 1 "" "") 0))
  2161.    (set (mem:QI (match_dup 3)) (subreg:QI (match_dup 2) 0))]
  2162.   ""
  2163.   "
  2164. {
  2165.   HOST_WIDE_INT value = INTVAL (operands[1]);
  2166.   enum rtx_code code = GET_CODE (operands[0]);
  2167.  
  2168.   if ((code == PLUS || code == MINUS)
  2169.       && (GET_CODE (XEXP (operands[0], 1)) == REG
  2170.       || GET_CODE (XEXP (operands[0], 0)) != REG))
  2171.   operands[0] = force_reg (SImode, operands[0]);
  2172.  
  2173.   operands[1] = gen_reg_rtx (SImode);
  2174.   if (BYTES_BIG_ENDIAN)
  2175.     {
  2176.       emit_insn (gen_movsi (operands[1], GEN_INT ((value >> 8) & 255)));
  2177.       if ((value & 255) == ((value >> 8) & 255))
  2178.     operands[2] = operands[1];
  2179.       else
  2180.     {
  2181.       operands[2] = gen_reg_rtx (SImode);
  2182.       emit_insn (gen_movsi (operands[2], GEN_INT (value & 255)));
  2183.     }
  2184.     }
  2185.   else
  2186.     {
  2187.       emit_insn (gen_movsi (operands[1], GEN_INT (value & 255)));
  2188.       if ((value & 255) == ((value >> 8) & 255))
  2189.     operands[2] = operands[1];
  2190.       else
  2191.     {
  2192.       operands[2] = gen_reg_rtx (SImode);
  2193.       emit_insn (gen_movsi (operands[2], GEN_INT ((value >> 8) & 255)));
  2194.     }
  2195.     }
  2196.  
  2197.   operands[3] = plus_constant (operands[0], 1);
  2198. }
  2199. ")
  2200.  
  2201. (define_expand "movhi"
  2202.   [(set (match_operand:HI 0 "general_operand" "")
  2203.     (match_operand:HI 1 "general_operand" ""))]
  2204.   ""
  2205.   "
  2206. {
  2207.   rtx insn;
  2208.  
  2209.   if (! (reload_in_progress || reload_completed))
  2210.     {
  2211.       if (GET_CODE (operands[0]) == MEM)
  2212.     {
  2213.       if (GET_CODE (operands[1]) == CONST_INT)
  2214.         emit_insn (gen_storeinthi (XEXP (operands[0], 0), operands[1]));
  2215.       else
  2216.         {
  2217.           if (GET_CODE (operands[1]) == MEM)
  2218.         operands[1] = force_reg (HImode, operands[1]);
  2219.           if (BYTES_BIG_ENDIAN)
  2220.         emit_insn (gen_storehi_bigend (operands[1],
  2221.                            XEXP (operands[0], 0)));
  2222.           else
  2223.         emit_insn (gen_storehi (operands[1], XEXP (operands[0], 0)));
  2224.         }
  2225.       DONE;
  2226.     }
  2227.       /* Sign extend a constant, and keep it in an SImode reg.  */
  2228.       else if (GET_CODE (operands[1]) == CONST_INT)
  2229.     {
  2230.       rtx reg = gen_reg_rtx (SImode);
  2231.       HOST_WIDE_INT val = INTVAL (operands[1]) & 0xffff;
  2232.  
  2233.       /* If the constant is already valid, leave it alone.  */
  2234.       if (! const_ok_for_arm (val))
  2235.         {
  2236.           /* If setting all the top bits will make the constant 
  2237.          loadable in a single instruction, then set them.  
  2238.          Otherwise, sign extend the number.  */
  2239.  
  2240.           if (const_ok_for_arm (~ (val | ~0xffff)))
  2241.         val |= ~0xffff;
  2242.           else if (val & 0x8000)
  2243.         val |= ~0xffff;
  2244.         }
  2245.  
  2246.       emit_insn (gen_movsi (reg, GEN_INT (val)));
  2247.       operands[1] = gen_rtx (SUBREG, HImode, reg, 0);
  2248.     }
  2249.       else if (TARGET_SHORT_BY_BYTES && GET_CODE (operands[1]) == MEM)
  2250.         {
  2251.       rtx reg = gen_reg_rtx (SImode);
  2252.       emit_insn (gen_movhi_bytes (reg, operands[1]));
  2253.       operands[1] = gen_lowpart (HImode, reg);
  2254.     }
  2255.       else if (BYTES_BIG_ENDIAN && GET_CODE (operands[1]) == MEM)
  2256.     {
  2257.       emit_insn (gen_movhi_bigend (operands[0], operands[1]));
  2258.       DONE;
  2259.     }
  2260.     }
  2261. }
  2262. ")
  2263.  
  2264. (define_expand "movhi_bytes"
  2265.   [(set (match_dup 2) (zero_extend:SI (mem:QI (match_operand:HI 1 "" ""))))
  2266.    (set (match_dup 3)
  2267.     (zero_extend:SI (mem:QI (plus:SI (match_dup 1) (const_int 1)))))
  2268.    (set (match_operand:SI 0 "" "")
  2269.      (ior:SI (ashift:SI (match_dup 4) (const_int 8)) (match_dup 5)))]
  2270.   ""
  2271.   "
  2272.   operands[0] = gen_lowpart (SImode, operands[0]);
  2273.   operands[1] = copy_to_mode_reg (SImode, XEXP (operands[1], 0));
  2274.   operands[2] = gen_reg_rtx (SImode);
  2275.   operands[3] = gen_reg_rtx (SImode);
  2276.  
  2277.   if (BYTES_BIG_ENDIAN)
  2278.     {
  2279.       operands[4] = operands[2];
  2280.       operands[5] = operands[3];
  2281.     }
  2282.   else
  2283.     {
  2284.       operands[4] = operands[3];
  2285.       operands[5] = operands[2];
  2286.     }
  2287. ")
  2288.  
  2289. (define_expand "movhi_bigend"
  2290.   [(set (match_dup 2)
  2291.     (rotate:SI (subreg:SI (match_operand:HI 1 "memory_operand" "") 0)
  2292.            (const_int 16)))
  2293.    (set (match_dup 3)
  2294.     (ashiftrt:SI (match_dup 2) (const_int 16)))
  2295.    (set (match_operand:HI 0 "s_register_operand" "")
  2296.     (subreg:HI (match_dup 3) 0))]
  2297.   ""
  2298.   "
  2299.   operands[2] = gen_reg_rtx (SImode);
  2300.   operands[3] = gen_reg_rtx (SImode);
  2301. ")
  2302.  
  2303. ;; Pattern to recognise insn generated default case above
  2304.  
  2305. (define_insn ""
  2306.   [(set (match_operand:HI 0 "general_operand" "=r,r,r")
  2307.     (match_operand:HI 1 "general_operand"  "rI,K,m"))]
  2308.   "! BYTES_BIG_ENDIAN
  2309.    && ! TARGET_SHORT_BY_BYTES
  2310.    && (GET_CODE (operands[1]) != CONST_INT
  2311.        || const_ok_for_arm (INTVAL (operands[1]))
  2312.        || const_ok_for_arm (~INTVAL (operands[1])))"
  2313.   "@
  2314.    mov%?\\t%0, %1\\t%@ movhi
  2315.    mvn%?\\t%0, #%B1\\t%@ movhi
  2316.    ldr%?\\t%0, %1\\t%@ movhi"
  2317. [(set_attr "type" "*,*,load")])
  2318.  
  2319. (define_insn ""
  2320.   [(set (match_operand:HI 0 "s_register_operand" "=r,r,r")
  2321.     (match_operand:HI 1 "general_operand"  "rI,K,m"))]
  2322.   "BYTES_BIG_ENDIAN
  2323.    && ! TARGET_SHORT_BY_BYTES
  2324.    && (GET_CODE (operands[1]) != CONST_INT
  2325.        || const_ok_for_arm (INTVAL (operands[1]))
  2326.        || const_ok_for_arm (~INTVAL (operands[1])))"
  2327.   "@
  2328.    mov%?\\t%0, %1\\t%@ movhi
  2329.    mvn%?\\t%0, #%B1\\t%@ movhi
  2330.    ldr%?\\t%0, %1\\t%@ movhi_bigend\;mov%?\\t%0, %0, asr #16"
  2331. [(set_attr "type" "*,*,load")
  2332.  (set_attr "length" "4,4,8")])
  2333.  
  2334. (define_insn ""
  2335.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  2336.     (rotate:SI (subreg:SI (match_operand:HI 1 "memory_operand" "m") 0)
  2337.            (const_int 16)))]
  2338.   "BYTES_BIG_ENDIAN
  2339.    && ! TARGET_SHORT_BY_BYTES"
  2340.   "ldr%?\\t%0, %1\\t%@ movhi_bigend"
  2341. [(set_attr "type" "load")])
  2342.  
  2343. (define_insn ""
  2344.   [(set (match_operand:HI 0 "s_register_operand" "=r,r")
  2345.     (match_operand:HI 1 "arm_rhs_operand"  "rI,K"))]
  2346.   "TARGET_SHORT_BY_BYTES"
  2347.   "@
  2348.    mov%?\\t%0, %1\\t%@ movhi
  2349.    mvn%?\\t%0, #%B1\\t%@ movhi")
  2350.  
  2351.  
  2352. (define_expand "reload_outhi"
  2353.   [(parallel [(match_operand:HI 0 "reload_memory_operand" "=o")
  2354.           (match_operand:HI 1 "s_register_operand" "r")
  2355.           (match_operand:SI 2 "s_register_operand" "=&r")])]
  2356.   ""
  2357.   "
  2358.   arm_reload_out_hi (operands);
  2359.   DONE;
  2360. ")
  2361.  
  2362. (define_expand "reload_inhi"
  2363.   [(parallel [(match_operand:HI 0 "s_register_operand" "=r")
  2364.           (match_operand:HI 1 "reload_memory_operand" "o")
  2365.           (match_operand:SI 2 "s_register_operand" "=&r")])]
  2366.   "TARGET_SHORT_BY_BYTES"
  2367.   "
  2368.   arm_reload_in_hi (operands);
  2369.   DONE;
  2370. ")
  2371.  
  2372. (define_expand "movqi"
  2373.   [(set (match_operand:QI 0 "general_operand" "")
  2374.         (match_operand:QI 1 "general_operand" ""))]
  2375.   ""
  2376.   "
  2377.   /* Everything except mem = const or mem = mem can be done easily */
  2378.  
  2379.   if (!(reload_in_progress || reload_completed))
  2380.     {
  2381.       if (GET_CODE (operands[1]) == CONST_INT)
  2382.     {
  2383.       rtx reg = gen_reg_rtx (SImode);
  2384.  
  2385.       emit_insn (gen_movsi (reg, operands[1]));
  2386.       operands[1] = gen_rtx (SUBREG, QImode, reg, 0);
  2387.     }
  2388.       if (GET_CODE (operands[0]) == MEM)
  2389.     operands[1] = force_reg (QImode, operands[1]);
  2390.     }
  2391. ")
  2392.  
  2393.  
  2394. (define_insn ""
  2395.   [(set (match_operand:QI 0 "general_operand" "=r,r,r,m")
  2396.     (match_operand:QI 1 "general_operand" "rI,K,m,r"))]
  2397.   "register_operand (operands[0], QImode)
  2398.    || register_operand (operands[1], QImode)"
  2399.   "@
  2400.    mov%?\\t%0, %1
  2401.    mvn%?\\t%0, #%B1
  2402.    ldr%?b\\t%0, %1
  2403.    str%?b\\t%1, %0"
  2404. [(set_attr "type" "*,*,load,store1")])
  2405.  
  2406. (define_expand "movsf"
  2407.   [(set (match_operand:SF 0 "general_operand" "")
  2408.     (match_operand:SF 1 "general_operand" ""))]
  2409.   ""
  2410.   "
  2411.   if (GET_CODE (operands[1]) == CONST_DOUBLE
  2412.       && (TARGET_SOFT_FLOAT
  2413.       || (GET_CODE (operands[0]) == REG
  2414.           && REGNO (operands[0]) < 16)
  2415.       || ! (const_double_rtx_ok_for_fpu (operands[1])
  2416.         || neg_const_double_rtx_ok_for_fpu (operands[1]))))
  2417.     {
  2418.       extern int optimize;
  2419.       rtx mem = force_const_mem (SFmode, operands[1]);
  2420.       rtx addr;
  2421.  
  2422.       if (reload_in_progress || reload_completed)
  2423.     addr = gen_rtx (REG, SImode, REGNO (operands[0]));
  2424.       else
  2425.         addr = gen_reg_rtx (SImode);
  2426.       if (optimize == 0)
  2427.     {
  2428.       rtx ptr = force_const_mem (SImode, XEXP (mem, 0));
  2429.       emit_insn (gen_movsi (addr, ptr));
  2430.     }
  2431.       else
  2432.     emit_insn (gen_movsi (addr, XEXP (mem, 0)));
  2433.       operands[1] = gen_rtx (MEM, SFmode, addr);
  2434.     }
  2435.   if (GET_CODE (operands[0]) == MEM)
  2436.     operands[1] = force_reg (SFmode, operands[1]);
  2437. ")
  2438.  
  2439. (define_insn ""
  2440.   [(set (match_operand:SF 0 "general_operand" "=f,f,f,m,f,r,r,r,m")
  2441.     (match_operand:SF 1 "general_operand" "fG,H,m,f,r,f,r,m,r"))]
  2442.   "TARGET_HARD_FLOAT
  2443.    && (GET_CODE (operands[0]) != MEM || register_operand (operands[1], SFmode))"
  2444.   "@
  2445.    mvf%?s\\t%0, %1
  2446.    mnf%?s\\t%0, #%N1
  2447.    ldf%?s\\t%0, %1
  2448.    stf%?s\\t%1, %0
  2449.    str%?\\t%1, [%|sp, #-4]!\;ldf%?s\\t%0, [%|sp], #4
  2450.    stf%?s\\t%1, [%|sp, #-4]!\;ldr%?\\t%0, [%|sp], #4
  2451.    mov%?\\t%0, %1
  2452.    ldr%?\\t%0, %1\\t%@ float
  2453.    str%?\\t%1, %0\\t%@ float"
  2454. [(set_attr "length" "4,4,4,4,8,8,4,4,4")
  2455.  (set_attr "type"
  2456.      "ffarith,ffarith,f_load,f_store,r_mem_f,f_mem_r,*,load,store1")])
  2457.  
  2458. ;; Exactly the same as above, except that all `f' cases are deleted.
  2459. ;; This is necessary to prevent reload from ever trying to use a `f' reg
  2460. ;; when -msoft-float.
  2461.  
  2462. (define_insn "*movsf_soft_insn"
  2463.   [(set (match_operand:SF 0 "general_operand" "=r,r,m")
  2464.     (match_operand:SF 1 "general_operand" "r,m,r"))]
  2465.   "TARGET_SOFT_FLOAT
  2466.    && (GET_CODE (operands[0]) != MEM || register_operand (operands[1], SFmode))"
  2467.   "@
  2468.    mov%?\\t%0, %1
  2469.    ldr%?\\t%0, %1\\t%@ float
  2470.    str%?\\t%1, %0\\t%@ float"
  2471. [(set_attr "length" "4,4,4")
  2472.  (set_attr "type" "*,load,store1")])
  2473.  
  2474. (define_expand "movdf"
  2475.   [(set (match_operand:DF 0 "general_operand" "")
  2476.     (match_operand:DF 1 "general_operand" ""))]
  2477.   ""
  2478.   "
  2479.   if (GET_CODE (operands[1]) == CONST_DOUBLE
  2480.       && (TARGET_SOFT_FLOAT
  2481.       || (GET_CODE (operands[0]) == REG
  2482.           && REGNO (operands[0]) < 16)
  2483.       || ! (const_double_rtx_ok_for_fpu (operands[1])
  2484.         || neg_const_double_rtx_ok_for_fpu (operands[1]))))
  2485.     {
  2486.       extern int optimize;
  2487.       rtx mem = force_const_mem (DFmode, operands[1]);
  2488.       rtx addr;
  2489.  
  2490.       if (reload_in_progress || reload_completed)
  2491.     addr = gen_rtx (REG, SImode, REGNO (operands[0]));
  2492.       else
  2493.     addr = gen_reg_rtx (SImode);
  2494.       if (optimize == 0)
  2495.     {
  2496.       rtx ptr = force_const_mem (SImode, XEXP (mem, 0));
  2497.       emit_insn (gen_movsi (addr, ptr));
  2498.     }
  2499.       else
  2500.     emit_insn (gen_movsi (addr, XEXP (mem, 0)));
  2501.       operands[1] = gen_rtx (MEM, DFmode, addr);
  2502.     }
  2503.   if (GET_CODE (operands[0]) == MEM)
  2504.     operands[1] = force_reg (DFmode, operands[1]);
  2505. ")
  2506.  
  2507. ;; Reloading a df mode value stored in integer regs to memory can require a
  2508. ;; scratch reg.
  2509. (define_expand "reload_outdf"
  2510.   [(match_operand:DF 0 "reload_memory_operand" "=o")
  2511.    (match_operand:DF 1 "s_register_operand" "r")
  2512.    (match_operand:SI 2 "s_register_operand" "=&r")]
  2513.   ""
  2514.   "
  2515.   if (GET_CODE (XEXP (operands[0], 0)) == REG)
  2516.     operands[2] = XEXP (operands[0], 0);
  2517.   else
  2518.     emit_insn (gen_addsi3 (operands[2], XEXP (XEXP (operands[0], 0), 0),
  2519.                XEXP (XEXP (operands[0], 0), 1)));
  2520.   emit_insn (gen_rtx (SET, VOIDmode, gen_rtx (MEM, DFmode, operands[2]),
  2521.               operands[1]));
  2522.   DONE;
  2523. ")
  2524.  
  2525. (define_insn ""
  2526.   [(set (match_operand:DF 0 "general_operand" "=r,Q#m,r,f,f,f,f,m,!f,!r,r")
  2527.     (match_operand:DF 1 "general_operand" 
  2528.          "Q,r,?o,?f,!G,!H,m,f,r,f,??r"))]
  2529.   "TARGET_HARD_FLOAT
  2530.    && (GET_CODE (operands[0]) != MEM || register_operand (operands[1], DFmode))"
  2531.   "*
  2532. {
  2533.   rtx ops[3];
  2534.  
  2535.   switch (which_alternative)
  2536.     {
  2537.     case 0:
  2538.       return \"ldm%?ia\\t%m1, {%0, %R0}\\t%@ double\";
  2539.  
  2540.     case 1:
  2541.       return \"stm%?ia\\t%m0, {%1, %R1}\\t%@ double\";
  2542.  
  2543.     case 2:
  2544.       ops[0] = operands[0];
  2545.       ops[1] = XEXP (XEXP (operands[1], 0), 0);
  2546.       ops[2] = XEXP (XEXP (operands[1], 0), 1);
  2547.       if (!INTVAL (ops[2]) || const_ok_for_arm (INTVAL (ops[2])))
  2548.     output_asm_insn (\"add%?\\t%0, %1, %2\", ops);
  2549.       else
  2550.     output_asm_insn (\"sub%?\\t%0, %1, #%n2\", ops);
  2551.       return \"ldm%?ia\\t%0, {%0, %R0}\\t%@ double\";
  2552.  
  2553.     case 3:
  2554.     case 4:
  2555.       return \"mvf%?d\\t%0, %1\";
  2556.  
  2557.     case 5: return \"mnf%?d\\t%0, #%N1\";
  2558.     case 6: return \"ldf%?d\\t%0, %1\";
  2559.     case 7: return \"stf%?d\\t%1, %0\";
  2560.     case 8: return output_mov_double_fpu_from_arm (operands);
  2561.     case 9: return output_mov_double_arm_from_fpu (operands);
  2562.     case 10: return output_move_double (operands);
  2563.     }
  2564. }
  2565. "
  2566. [(set_attr "length" "4,4,8,4,4,4,4,4,8,8,8")
  2567.  (set_attr "type" 
  2568. "load,store2,load,ffarith,ffarith,ffarith,f_load,f_store,r_mem_f,f_mem_r,*")])
  2569.  
  2570. ;; Software floating point version.  This is essentially the same as movdi.
  2571. ;; Do not use `f' as a constraint to prevent reload from ever trying to use
  2572. ;; an `f' reg.
  2573.  
  2574. (define_insn "*movdf_soft_insn"
  2575.   [(set (match_operand:DF 0 "soft_df_operand" "=r,r,o<>,r")
  2576.     (match_operand:DF 1 "soft_df_operand" "r,o<>,r,F"))]
  2577.   "TARGET_SOFT_FLOAT"
  2578.   "* return output_move_double (operands);"
  2579. [(set_attr "length" "8,8,8,32")
  2580.  (set_attr "type" "*,load,store2,*")])
  2581.  
  2582. (define_expand "movxf"
  2583.   [(set (match_operand:XF 0 "general_operand" "")
  2584.     (match_operand:XF 1 "general_operand" ""))]
  2585.   "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
  2586.   "")
  2587.  
  2588. ;; Even when the XFmode patterns aren't enabled, we enable this after
  2589. ;; reloading so that we can push floating point registers in the prologue.
  2590.  
  2591. (define_insn ""
  2592.   [(set (match_operand:XF 0 "general_operand" "=f,f,f,m,f,r,r")
  2593.     (match_operand:XF 1 "general_operand" "fG,H,m,f,r,f,r"))]
  2594.   "TARGET_HARD_FLOAT && (ENABLE_XF_PATTERNS || reload_completed)"
  2595.   "*
  2596.   switch (which_alternative)
  2597.     {
  2598.     case 0: return \"mvf%?e\\t%0, %1\";
  2599.     case 1: return \"mnf%?e\\t%0, #%N1\";
  2600.     case 2: return \"ldf%?e\\t%0, %1\";
  2601.     case 3: return \"stf%?e\\t%1, %0\";
  2602.     case 4: return output_mov_long_double_fpu_from_arm (operands);
  2603.     case 5: return output_mov_long_double_arm_from_fpu (operands);
  2604.     case 6: return output_mov_long_double_arm_from_arm (operands);
  2605.     }
  2606. "
  2607. [(set_attr "length" "4,4,4,4,8,8,12")
  2608.  (set_attr "type" "ffarith,ffarith,f_load,f_store,r_mem_f,f_mem_r,*")])
  2609.  
  2610.  
  2611. ;; load- and store-multiple insns
  2612. ;; The arm can load/store any set of registers, provided that they are in
  2613. ;; ascending order; but that is beyond GCC so stick with what it knows.
  2614.  
  2615. (define_expand "load_multiple"
  2616.   [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
  2617.                           (match_operand:SI 1 "" ""))
  2618.                      (use (match_operand:SI 2 "" ""))])]
  2619.   ""
  2620.   "
  2621.   /* Support only fixed point registers */
  2622.   if (GET_CODE (operands[2]) != CONST_INT
  2623.       || INTVAL (operands[2]) > 14
  2624.       || INTVAL (operands[2]) < 2
  2625.       || GET_CODE (operands[1]) != MEM
  2626.       || GET_CODE (operands[0]) != REG
  2627.       || REGNO (operands[0]) > 14
  2628.       || REGNO (operands[0]) + INTVAL (operands[2]) > 15)
  2629.     FAIL;
  2630.  
  2631.   operands[3]
  2632.             = arm_gen_load_multiple (REGNO (operands[0]), INTVAL (operands[2]),
  2633.                                      force_reg (SImode, XEXP (operands[1], 0)),
  2634.                                      TRUE, FALSE);
  2635. ")
  2636.  
  2637. ;; Load multiple with write-back
  2638.  
  2639. (define_insn ""
  2640.   [(match_parallel 0 "load_multiple_operation"
  2641.                    [(set (match_operand:SI 1 "s_register_operand" "+r")
  2642.                          (plus:SI (match_dup 1)
  2643.                                   (match_operand:SI 2 "immediate_operand" "n")))
  2644.                     (set (match_operand:SI 3 "s_register_operand" "=r")
  2645.                          (mem:SI (match_dup 1)))])]
  2646.   "(INTVAL (operands[2])  == 4 * (XVECLEN (operands[0], 0) - 2))"
  2647.   "*
  2648. {
  2649.   rtx ops[3];
  2650.   int count = XVECLEN (operands[0], 0);
  2651.  
  2652.   ops[0] = XEXP (SET_SRC (XVECEXP (operands[0], 0, 0)), 0);
  2653.   ops[1] = SET_DEST (XVECEXP (operands[0], 0, 1));
  2654.   ops[2] = SET_DEST (XVECEXP (operands[0], 0, count - 2));
  2655.  
  2656.   output_asm_insn (\"ldm%?ia\\t%0!, {%1-%2}\\t%@ load multiple\", ops);
  2657.   return \"\";
  2658. }
  2659. "
  2660. [(set_attr "type" "load")])
  2661.  
  2662. ;; Ordinary load multiple
  2663.  
  2664. (define_insn ""
  2665.   [(match_parallel 0 "load_multiple_operation"
  2666.                    [(set (match_operand:SI 1 "s_register_operand" "=r")
  2667.                          (match_operand:SI 2 "indirect_operand" "Q"))])]
  2668.   ""
  2669.   "*
  2670. {
  2671.   rtx ops[3];
  2672.   int count = XVECLEN (operands[0], 0);
  2673.  
  2674.   ops[0] = XEXP (SET_SRC (XVECEXP (operands[0], 0, 0)), 0);
  2675.   ops[1] = SET_DEST (XVECEXP (operands[0], 0, 0));
  2676.   ops[2] = SET_DEST (XVECEXP (operands[0], 0, count - 1));
  2677.  
  2678.   output_asm_insn (\"ldm%?ia\\t%0, {%1-%2}\\t%@ load multiple\", ops);
  2679.   return \"\";
  2680. }
  2681. "
  2682. [(set_attr "type" "load")])
  2683.  
  2684. (define_expand "store_multiple"
  2685.   [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
  2686.                           (match_operand:SI 1 "" ""))
  2687.                      (use (match_operand:SI 2 "" ""))])]
  2688.   ""
  2689.   "
  2690.   /* Support only fixed point registers */
  2691.   if (GET_CODE (operands[2]) != CONST_INT
  2692.       || INTVAL (operands[2]) > 14
  2693.       || INTVAL (operands[2]) < 2
  2694.       || GET_CODE (operands[1]) != REG
  2695.       || GET_CODE (operands[0]) != MEM
  2696.       || REGNO (operands[1]) > 14
  2697.       || REGNO (operands[1]) + INTVAL (operands[2]) > 15)
  2698.     FAIL;
  2699.  
  2700.   operands[3]
  2701.            = arm_gen_store_multiple (REGNO (operands[1]), INTVAL (operands[2]),
  2702.                                      force_reg (SImode, XEXP (operands[0], 0)),
  2703.                                      TRUE, FALSE);
  2704. ")
  2705.  
  2706. ;; Store multiple with write-back
  2707.  
  2708. (define_insn ""
  2709.   [(match_parallel 0 "store_multiple_operation"
  2710.                    [(set (match_operand:SI 1 "s_register_operand" "+r")
  2711.                          (plus:SI (match_dup 1)
  2712.                                   (match_operand:SI 2 "immediate_operand" "n")))
  2713.                     (set (mem:SI (match_dup 1))
  2714.                          (match_operand:SI 3 "s_register_operand" "r"))])]
  2715.   "(INTVAL (operands[2]) == 4 * (XVECLEN (operands[0], 0) - 2))"
  2716.   "*
  2717. {
  2718.   rtx ops[3];
  2719.   int count = XVECLEN (operands[0], 0);
  2720.  
  2721.   ops[0] = XEXP (SET_SRC (XVECEXP (operands[0], 0, 0)), 0);
  2722.   ops[1] = SET_SRC (XVECEXP (operands[0], 0, 1));
  2723.   ops[2] = SET_SRC (XVECEXP (operands[0], 0, count - 2));
  2724.  
  2725.   output_asm_insn (\"stm%?ia\\t%0!, {%1-%2}\\t%@ str multiple\", ops);
  2726.   return \"\";
  2727. }
  2728. "
  2729. [(set (attr "type")
  2730.       (cond [(eq (symbol_ref "XVECLEN (operands[0],0)") (const_int 4))
  2731.         (const_string "store2")
  2732.          (eq (symbol_ref "XVECLEN (operands[0],0)") (const_int 5))
  2733.         (const_string "store3")]
  2734.       (const_string "store4")))])
  2735.  
  2736. ;; Ordinary store multiple
  2737.  
  2738. (define_insn ""
  2739.   [(match_parallel 0 "store_multiple_operation"
  2740.                    [(set (match_operand:SI 2 "indirect_operand" "=Q")
  2741.                          (match_operand:SI 1 "s_register_operand" "r"))])]
  2742.   ""
  2743.   "*
  2744. {
  2745.   rtx ops[3];
  2746.   int count = XVECLEN (operands[0], 0);
  2747.  
  2748.   ops[0] = XEXP (SET_DEST (XVECEXP (operands[0], 0, 0)), 0);
  2749.   ops[1] = SET_SRC (XVECEXP (operands[0], 0, 0));
  2750.   ops[2] = SET_SRC (XVECEXP (operands[0], 0, count - 1));
  2751.  
  2752.   output_asm_insn (\"stm%?ia\\t%0, {%1-%2}\\t%@ str multiple\", ops);
  2753.   return \"\";
  2754. }
  2755. "
  2756. [(set (attr "type")
  2757.       (cond [(eq (symbol_ref "XVECLEN (operands[0],0)") (const_int 3))
  2758.         (const_string "store2")
  2759.          (eq (symbol_ref "XVECLEN (operands[0],0)") (const_int 4))
  2760.         (const_string "store3")]
  2761.       (const_string "store4")))])
  2762.  
  2763. ;; Move a block of memory if it is word aligned and MORE than 2 words long.
  2764. ;; We could let this apply for blocks of less than this, but it clobbers so
  2765. ;; many registers that there is then probably a better way.
  2766.  
  2767. (define_expand "movstrqi"
  2768.   [(match_operand:BLK 0 "general_operand" "")
  2769.    (match_operand:BLK 1 "general_operand" "")
  2770.    (match_operand:SI 2 "const_int_operand" "")
  2771.    (match_operand:SI 3 "const_int_operand" "")]
  2772.   ""
  2773.   "
  2774.   if (arm_gen_movstrqi (operands))
  2775.     DONE;
  2776.   FAIL;
  2777. ")
  2778.  
  2779.  
  2780. ;; Comparison and test insns
  2781.  
  2782. (define_expand "cmpsi"
  2783.   [(set (reg:CC 24)
  2784.     (compare:CC (match_operand:SI 0 "s_register_operand" "")
  2785.                (match_operand:SI 1 "arm_add_operand" "")))]
  2786.   ""
  2787.   "
  2788. {
  2789.   arm_compare_op0 = operands[0];
  2790.   arm_compare_op1 = operands[1];
  2791.   arm_compare_fp = 0;
  2792.   DONE;
  2793. }
  2794. ")
  2795.  
  2796. (define_expand "cmpsf"
  2797.   [(set (reg:CC 24)
  2798.     (compare:CC (match_operand:SF 0 "s_register_operand" "")
  2799.             (match_operand:SF 1 "fpu_rhs_operand" "")))]
  2800.   "TARGET_HARD_FLOAT"
  2801.   "
  2802. {
  2803.   arm_compare_op0 = operands[0];
  2804.   arm_compare_op1 = operands[1];
  2805.   arm_compare_fp = 1;
  2806.   DONE;
  2807. }
  2808. ")
  2809.  
  2810. (define_expand "cmpdf"
  2811.   [(set (reg:CC 24)
  2812.     (compare:CC (match_operand:DF 0 "s_register_operand" "")
  2813.             (match_operand:DF 1 "fpu_rhs_operand" "")))]
  2814.   "TARGET_HARD_FLOAT"
  2815.   "
  2816. {
  2817.   arm_compare_op0 = operands[0];
  2818.   arm_compare_op1 = operands[1];
  2819.   arm_compare_fp = 1;
  2820.   DONE;
  2821. }
  2822. ")
  2823.  
  2824. (define_expand "cmpxf"
  2825.   [(set (reg:CC 24)
  2826.     (compare:CC (match_operand:XF 0 "s_register_operand" "")
  2827.             (match_operand:XF 1 "fpu_rhs_operand" "")))]
  2828.   "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
  2829.   "
  2830. {
  2831.   arm_compare_op0 = operands[0];
  2832.   arm_compare_op1 = operands[1];
  2833.   arm_compare_fp = 1;
  2834.   DONE;
  2835. }
  2836. ")
  2837.  
  2838. (define_insn ""
  2839.   [(set (match_operand 0 "cc_register" "")
  2840.     (compare (match_operand:SI 1 "s_register_operand" "r,r")
  2841.          (match_operand:SI 2 "arm_add_operand" "rI,L")))]
  2842.   ""
  2843.   "@
  2844.    cmp%?\\t%1, %2
  2845.    cmn%?\\t%1, #%n2"
  2846. [(set_attr "conds" "set")])
  2847.  
  2848. (define_insn ""
  2849.   [(set (match_operand 0 "cc_register" "")
  2850.     (compare (match_operand:SI 1 "s_register_operand" "r")
  2851.          (neg:SI (match_operand:SI 2 "s_register_operand" "r"))))]
  2852.   ""
  2853.   "cmn%?\\t%1, %2"
  2854. [(set_attr "conds" "set")])
  2855.  
  2856. (define_insn ""
  2857.   [(set (match_operand 0 "cc_register" "")
  2858.     (compare (match_operand:SI 1 "s_register_operand" "r")
  2859.          (match_operator:SI 2 "shift_operator"
  2860.           [(match_operand:SI 3 "s_register_operand" "r")
  2861.            (match_operand:SI 4 "arm_rhs_operand" "rM")])))]
  2862.   ""
  2863.   "cmp%?\\t%1, %3%S2"
  2864. [(set_attr "conds" "set")])
  2865.  
  2866. (define_insn ""
  2867.   [(set (match_operand 0 "cc_register" "")
  2868.     (compare (match_operand:SI 1 "s_register_operand" "r")
  2869.          (neg:SI (match_operator:SI 2 "shift_operator"
  2870.               [(match_operand:SI 3 "s_register_operand" "r")
  2871.                (match_operand:SI 4 "arm_rhs_operand" "rM")]))))]
  2872.   ""
  2873.   "cmn%?\\t%1, %3%S2"
  2874. [(set_attr "conds" "set")])
  2875.  
  2876. (define_insn ""
  2877.   [(set (reg:CCFP 24)
  2878.     (compare:CCFP (match_operand:SF 0 "s_register_operand" "f,f")
  2879.               (match_operand:SF 1 "fpu_add_operand" "fG,H")))]
  2880.   "TARGET_HARD_FLOAT"
  2881.   "@
  2882.    cmf%?\\t%0, %1
  2883.    cnf%?\\t%0, #%N1"
  2884. [(set_attr "conds" "set")
  2885.  (set_attr "type" "f_2_r")])
  2886.  
  2887. (define_insn ""
  2888.   [(set (reg:CCFP 24)
  2889.     (compare:CCFP (match_operand:DF 0 "s_register_operand" "f,f")
  2890.               (match_operand:DF 1 "fpu_add_operand" "fG,H")))]
  2891.   "TARGET_HARD_FLOAT"
  2892.   "@
  2893.    cmf%?\\t%0, %1
  2894.    cnf%?\\t%0, #%N1"
  2895. [(set_attr "conds" "set")
  2896.  (set_attr "type" "f_2_r")])
  2897.  
  2898. (define_insn ""
  2899.   [(set (reg:CCFP 24)
  2900.     (compare:CCFP (float_extend:DF
  2901.                (match_operand:SF 0 "s_register_operand" "f,f"))
  2902.               (match_operand:DF 1 "fpu_add_operand" "fG,H")))]
  2903.   "TARGET_HARD_FLOAT"
  2904.   "@
  2905.    cmf%?\\t%0, %1
  2906.    cnf%?\\t%0, #%N1"
  2907. [(set_attr "conds" "set")
  2908.  (set_attr "type" "f_2_r")])
  2909.  
  2910. (define_insn ""
  2911.   [(set (reg:CCFP 24)
  2912.     (compare:CCFP (match_operand:DF 0 "s_register_operand" "f")
  2913.               (float_extend:DF
  2914.                (match_operand:SF 1 "s_register_operand" "f"))))]
  2915.   "TARGET_HARD_FLOAT"
  2916.   "cmf%?\\t%0, %1"
  2917. [(set_attr "conds" "set")
  2918.  (set_attr "type" "f_2_r")])
  2919.  
  2920. (define_insn ""
  2921.   [(set (reg:CCFP 24)
  2922.     (compare:CCFP (match_operand:XF 0 "s_register_operand" "f,f")
  2923.               (match_operand:XF 1 "fpu_add_operand" "fG,H")))]
  2924.   "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
  2925.   "@
  2926.    cmf%?\\t%0, %1
  2927.    cnf%?\\t%0, #%N1"
  2928. [(set_attr "conds" "set")
  2929.  (set_attr "type" "f_2_r")])
  2930.  
  2931. (define_insn ""
  2932.   [(set (reg:CCFPE 24)
  2933.     (compare:CCFPE (match_operand:SF 0 "s_register_operand" "f,f")
  2934.                (match_operand:SF 1 "fpu_add_operand" "fG,H")))]
  2935.   "TARGET_HARD_FLOAT"
  2936.   "@
  2937.    cmf%?e\\t%0, %1
  2938.    cnf%?e\\t%0, #%N1"
  2939. [(set_attr "conds" "set")
  2940.  (set_attr "type" "f_2_r")])
  2941.  
  2942. (define_insn ""
  2943.   [(set (reg:CCFPE 24)
  2944.     (compare:CCFPE (match_operand:DF 0 "s_register_operand" "f,f")
  2945.                (match_operand:DF 1 "fpu_add_operand" "fG,H")))]
  2946.   "TARGET_HARD_FLOAT"
  2947.   "@
  2948.    cmf%?e\\t%0, %1
  2949.    cnf%?e\\t%0, #%N1"
  2950. [(set_attr "conds" "set")
  2951.  (set_attr "type" "f_2_r")])
  2952.  
  2953. (define_insn ""
  2954.   [(set (reg:CCFPE 24)
  2955.     (compare:CCFPE (float_extend:DF
  2956.             (match_operand:SF 0 "s_register_operand" "f,f"))
  2957.                (match_operand:DF 1 "fpu_add_operand" "fG,H")))]
  2958.   "TARGET_HARD_FLOAT"
  2959.   "@
  2960.    cmf%?e\\t%0, %1
  2961.    cnf%?e\\t%0, #%N1"
  2962. [(set_attr "conds" "set")
  2963.  (set_attr "type" "f_2_r")])
  2964.  
  2965. (define_insn ""
  2966.   [(set (reg:CCFPE 24)
  2967.     (compare:CCFPE (match_operand:DF 0 "s_register_operand" "f")
  2968.                (float_extend:DF
  2969.             (match_operand:SF 1 "s_register_operand" "f"))))]
  2970.   "TARGET_HARD_FLOAT"
  2971.   "cmf%?e\\t%0, %1"
  2972. [(set_attr "conds" "set")
  2973.  (set_attr "type" "f_2_r")])
  2974.  
  2975. (define_insn ""
  2976.   [(set (reg:CCFPE 24)
  2977.     (compare:CCFPE (match_operand:XF 0 "s_register_operand" "f,f")
  2978.                (match_operand:XF 1 "fpu_add_operand" "fG,H")))]
  2979.   "ENABLE_XF_PATTERNS && TARGET_HARD_FLOAT"
  2980.   "@
  2981.    cmf%?e\\t%0, %1
  2982.    cnf%?e\\t%0, #%N1"
  2983. [(set_attr "conds" "set")
  2984.  (set_attr "type" "f_2_r")])
  2985.  
  2986. ; This insn allows redundant compares to be removed by cse, nothing should
  2987. ; ever appear in the output file since (set (reg x) (reg x)) is a no-op that
  2988. ; is deleted later on. The match_dup will match the mode here, so that
  2989. ; mode changes of the condition codes aren't lost by this even though we don't
  2990. ; specify what they are.
  2991.  
  2992. (define_insn ""
  2993.   [(set (match_operand 0 "cc_register" "") (match_dup 0))]
  2994.   ""
  2995.   "\\t%@ deleted compare"
  2996. [(set_attr "conds" "set")
  2997.  (set_attr "length" "0")])
  2998.  
  2999.  
  3000. ;; Conditional branch insns
  3001.  
  3002. (define_expand "beq"
  3003.   [(set (pc)
  3004.     (if_then_else (eq (match_dup 1) (const_int 0))
  3005.               (label_ref (match_operand 0 "" ""))
  3006.               (pc)))]
  3007.   ""
  3008.   "
  3009. {
  3010.   operands[1] = gen_compare_reg (EQ, arm_compare_op0, arm_compare_op1,
  3011.                  arm_compare_fp);
  3012. }
  3013. ")
  3014.  
  3015. (define_expand "bne"
  3016.   [(set (pc)
  3017.     (if_then_else (ne (match_dup 1) (const_int 0))
  3018.               (label_ref (match_operand 0 "" ""))
  3019.               (pc)))]
  3020.   ""
  3021.   "
  3022. {
  3023.   operands[1] = gen_compare_reg (NE, arm_compare_op0, arm_compare_op1,
  3024.                  arm_compare_fp);
  3025. }
  3026. ")
  3027.  
  3028. (define_expand "bgt"
  3029.   [(set (pc)
  3030.     (if_then_else (gt (match_dup 1) (const_int 0))
  3031.               (label_ref (match_operand 0 "" ""))
  3032.               (pc)))]
  3033.   ""
  3034.   "
  3035. {
  3036.   operands[1] = gen_compare_reg (GT, arm_compare_op0, arm_compare_op1,
  3037.                  arm_compare_fp);
  3038. }
  3039. ")
  3040.  
  3041. (define_expand "ble"
  3042.   [(set (pc)
  3043.     (if_then_else (le (match_dup 1) (const_int 0))
  3044.               (label_ref (match_operand 0 "" ""))
  3045.               (pc)))]
  3046.   ""
  3047.   "
  3048. {
  3049.   operands[1] = gen_compare_reg (LE, arm_compare_op0, arm_compare_op1,
  3050.                  arm_compare_fp);
  3051. }
  3052. ")
  3053.  
  3054. (define_expand "bge"
  3055.   [(set (pc)
  3056.     (if_then_else (ge (match_dup 1) (const_int 0))
  3057.               (label_ref (match_operand 0 "" ""))
  3058.               (pc)))]
  3059.   ""
  3060.   "
  3061. {
  3062.   operands[1] = gen_compare_reg (GE, arm_compare_op0, arm_compare_op1,
  3063.                  arm_compare_fp);
  3064. }
  3065. ")
  3066.  
  3067. (define_expand "blt"
  3068.   [(set (pc)
  3069.     (if_then_else (lt (match_dup 1) (const_int 0))
  3070.               (label_ref (match_operand 0 "" ""))
  3071.               (pc)))]
  3072.   ""
  3073.   "
  3074. {
  3075.   operands[1] = gen_compare_reg (LT, arm_compare_op0, arm_compare_op1,
  3076.                  arm_compare_fp);
  3077. }
  3078. ")
  3079.  
  3080. (define_expand "bgtu"
  3081.   [(set (pc)
  3082.     (if_then_else (gtu (match_dup 1) (const_int 0))
  3083.               (label_ref (match_operand 0 "" ""))
  3084.               (pc)))]
  3085.   ""
  3086.   "
  3087. {
  3088.   operands[1] = gen_compare_reg (GTU, arm_compare_op0, arm_compare_op1,
  3089.                  arm_compare_fp);
  3090. }
  3091. ")
  3092.  
  3093. (define_expand "bleu"
  3094.   [(set (pc)
  3095.     (if_then_else (leu (match_dup 1) (const_int 0))
  3096.               (label_ref (match_operand 0 "" ""))
  3097.               (pc)))]
  3098.   ""
  3099.   "
  3100. {
  3101.   operands[1] = gen_compare_reg (LEU, arm_compare_op0, arm_compare_op1,
  3102.                  arm_compare_fp);
  3103. }
  3104. ")
  3105.  
  3106. (define_expand "bgeu"
  3107.   [(set (pc)
  3108.     (if_then_else (geu (match_dup 1) (const_int 0))
  3109.               (label_ref (match_operand 0 "" ""))
  3110.               (pc)))]
  3111.   ""
  3112.   "
  3113. {
  3114.   operands[1] = gen_compare_reg (GEU, arm_compare_op0, arm_compare_op1,
  3115.                  arm_compare_fp);
  3116. }
  3117. ")
  3118.  
  3119. (define_expand "bltu"
  3120.   [(set (pc)
  3121.     (if_then_else (ltu (match_dup 1) (const_int 0))
  3122.               (label_ref (match_operand 0 "" ""))
  3123.               (pc)))]
  3124.   ""
  3125.   "
  3126. {
  3127.   operands[1] = gen_compare_reg (LTU, arm_compare_op0, arm_compare_op1,
  3128.                  arm_compare_fp);
  3129. }
  3130. ")
  3131.  
  3132. ;; patterns to match conditional branch insns
  3133.  
  3134. (define_insn ""
  3135.   [(set (pc)
  3136.     (if_then_else (match_operator 1 "comparison_operator"
  3137.                     [(reg 24) (const_int 0)])
  3138.               (label_ref (match_operand 0 "" ""))
  3139.               (pc)))]
  3140.   ""
  3141.   "*
  3142. {
  3143.   extern int arm_ccfsm_state;
  3144.  
  3145.   if (arm_ccfsm_state == 1 || arm_ccfsm_state == 2)
  3146.   {
  3147.     arm_ccfsm_state += 2;
  3148.     return \"\";
  3149.   }
  3150.   return \"b%d1\\t%l0\";
  3151. }"
  3152. [(set_attr "conds" "use")])
  3153.  
  3154. (define_insn ""
  3155.   [(set (pc)
  3156.     (if_then_else (match_operator 1 "comparison_operator"
  3157.                     [(reg 24) (const_int 0)])
  3158.               (pc)
  3159.               (label_ref (match_operand 0 "" ""))))]
  3160.   "REVERSIBLE_CC_MODE (GET_MODE (XEXP (operands[1], 0)))"
  3161.   "*
  3162. {
  3163.   extern int arm_ccfsm_state;
  3164.  
  3165.   if (arm_ccfsm_state == 1 || arm_ccfsm_state == 2)
  3166.   {
  3167.     arm_ccfsm_state += 2;
  3168.     return \"\";
  3169.   }
  3170.   return \"b%D1\\t%l0\";
  3171. }"
  3172. [(set_attr "conds" "use")])
  3173.  
  3174.  
  3175. ; scc insns
  3176.  
  3177. (define_expand "seq"
  3178.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  3179.     (eq:SI (match_dup 1) (const_int 0)))]
  3180.   ""
  3181.   "
  3182. {
  3183.   operands[1] = gen_compare_reg (EQ, arm_compare_op0, arm_compare_op1,
  3184.                  arm_compare_fp);
  3185. }
  3186. ")
  3187.  
  3188. (define_expand "sne"
  3189.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  3190.     (ne:SI (match_dup 1) (const_int 0)))]
  3191.   ""
  3192.   "
  3193. {
  3194.   operands[1] = gen_compare_reg (NE, arm_compare_op0, arm_compare_op1,
  3195.                  arm_compare_fp);
  3196. }
  3197. ")
  3198.  
  3199. (define_expand "sgt"
  3200.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  3201.     (gt:SI (match_dup 1) (const_int 0)))]
  3202.   ""
  3203.   "
  3204. {
  3205.   operands[1] = gen_compare_reg (GT, arm_compare_op0, arm_compare_op1,
  3206.                  arm_compare_fp);
  3207. }
  3208. ")
  3209.  
  3210. (define_expand "sle"
  3211.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  3212.     (le:SI (match_dup 1) (const_int 0)))]
  3213.   ""
  3214.   "
  3215. {
  3216.   operands[1] = gen_compare_reg (LE, arm_compare_op0, arm_compare_op1,
  3217.                  arm_compare_fp);
  3218. }
  3219. ")
  3220.  
  3221. (define_expand "sge"
  3222.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  3223.     (ge:SI (match_dup 1) (const_int 0)))]
  3224.   ""
  3225.   "
  3226. {
  3227.   operands[1] = gen_compare_reg (GE, arm_compare_op0, arm_compare_op1,
  3228.                  arm_compare_fp);
  3229. }
  3230. ")
  3231.  
  3232. (define_expand "slt"
  3233.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  3234.     (lt:SI (match_dup 1) (const_int 0)))]
  3235.   ""
  3236.   "
  3237. {
  3238.   operands[1] = gen_compare_reg (LT, arm_compare_op0, arm_compare_op1,
  3239.                  arm_compare_fp);
  3240. }
  3241. ")
  3242.  
  3243. (define_expand "sgtu"
  3244.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  3245.     (gtu:SI (match_dup 1) (const_int 0)))]
  3246.   ""
  3247.   "
  3248. {
  3249.   operands[1] = gen_compare_reg (GTU, arm_compare_op0, arm_compare_op1,
  3250.                  arm_compare_fp);
  3251. }
  3252. ")
  3253.  
  3254. (define_expand "sleu"
  3255.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  3256.     (leu:SI (match_dup 1) (const_int 0)))]
  3257.   ""
  3258.   "
  3259. {
  3260.   operands[1] = gen_compare_reg (LEU, arm_compare_op0, arm_compare_op1,
  3261.                  arm_compare_fp);
  3262. }
  3263. ")
  3264.  
  3265. (define_expand "sgeu"
  3266.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  3267.     (geu:SI (match_dup 1) (const_int 0)))]
  3268.   ""
  3269.   "
  3270. {
  3271.   operands[1] = gen_compare_reg (GEU, arm_compare_op0, arm_compare_op1,
  3272.                  arm_compare_fp);
  3273. }
  3274. ")
  3275.  
  3276. (define_expand "sltu"
  3277.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  3278.     (ltu:SI (match_dup 1) (const_int 0)))]
  3279.   ""
  3280.   "
  3281. {
  3282.   operands[1] = gen_compare_reg (LTU, arm_compare_op0, arm_compare_op1,
  3283.                  arm_compare_fp);
  3284. }
  3285. ")
  3286.  
  3287. (define_insn ""
  3288.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  3289.     (match_operator:SI 1 "comparison_operator" [(reg 24) (const_int 0)]))]
  3290.   ""
  3291.   "mov%D1\\t%0, #0\;mov%d1\\t%0, #1"
  3292. [(set_attr "conds" "use")
  3293.  (set_attr "length" "8")])
  3294.  
  3295. (define_insn ""
  3296.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  3297.     (neg:SI (match_operator:SI 1 "comparison_operator"
  3298.          [(reg 24) (const_int 0)])))]
  3299.   ""
  3300.   "mov%D1\\t%0, #0\;mvn%d1\\t%0, #0"
  3301. [(set_attr "conds" "use")
  3302.  (set_attr "length" "8")])
  3303.  
  3304. (define_insn ""
  3305.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  3306.     (not:SI (match_operator:SI 1 "comparison_operator"
  3307.          [(reg 24) (const_int 0)])))]
  3308.   ""
  3309.   "mov%D1\\t%0, #0\;mvn%d1\\t%0, #1"
  3310. [(set_attr "conds" "use")
  3311.  (set_attr "length" "8")])
  3312.  
  3313.  
  3314. ;; Conditional move insns
  3315.  
  3316. (define_expand "movsicc"
  3317.   [(set (match_operand:SI 0 "register_operand" "")
  3318.     (if_then_else (match_operand 1 "comparison_operator" "")
  3319.               (match_operand:SI 2 "arm_not_operand" "")
  3320.               (match_operand:SI 3 "register_operand" "")))]
  3321.   ""
  3322.   "
  3323. {
  3324.   enum rtx_code code = GET_CODE (operands[1]);
  3325.   rtx ccreg = gen_rtx (REG,
  3326.                SELECT_CC_MODE (code, arm_compare_op0, arm_compare_op1),
  3327.                CC_REGNUM);
  3328.  
  3329.   operands[1] = gen_rtx (code, VOIDmode, ccreg, const0_rtx);
  3330. }")
  3331.  
  3332. (define_expand "movsfcc"
  3333.   [(set (match_operand:SF 0 "register_operand" "")
  3334.     (if_then_else (match_operand 1 "comparison_operator" "")
  3335.               (match_operand:SF 2 "nonmemory_operand" "")
  3336.               (match_operand:SF 3 "register_operand" "")))]
  3337.   ""
  3338.   "
  3339. {
  3340.   enum rtx_code code = GET_CODE (operands[1]);
  3341.   rtx ccreg = gen_rtx (REG,
  3342.                SELECT_CC_MODE (code, arm_compare_op0, arm_compare_op1),
  3343.                CC_REGNUM);
  3344.  
  3345.   operands[1] = gen_rtx (code, VOIDmode, ccreg, const0_rtx);
  3346. }")
  3347.  
  3348. (define_expand "movdfcc"
  3349.   [(set (match_operand:DF 0 "register_operand" "")
  3350.     (if_then_else (match_operand 1 "comparison_operator" "")
  3351.               (match_operand:DF 2 "nonmemory_operand" "")
  3352.               (match_operand:DF 3 "register_operand" "")))]
  3353.   "TARGET_HARD_FLOAT"
  3354.   "
  3355. {
  3356.   enum rtx_code code = GET_CODE (operands[1]);
  3357.   rtx ccreg = gen_rtx (REG,
  3358.                SELECT_CC_MODE (code, arm_compare_op0, arm_compare_op1),
  3359.                CC_REGNUM);
  3360.  
  3361.   operands[1] = gen_rtx (code, VOIDmode, ccreg, const0_rtx);
  3362. }")
  3363.  
  3364. (define_insn "*movsicc_insn"
  3365.   [(set (match_operand:SI 0 "register_operand" "=r,r")
  3366.     (if_then_else (match_operand 1 "comparison_operator" "")
  3367.               (match_operand:SI 2 "arm_not_operand" "rI,K")
  3368.               (match_operand:SI 3 "register_operand" "0,0")))]
  3369.   ""
  3370.   "@
  3371.    mov%d1\\t%0, %2
  3372.    mvn%d1\\t%0, #%B2"
  3373.   [(set_attr "type" "*,*")
  3374.    (set_attr "conds" "use,use")])
  3375.  
  3376. (define_insn "*movsfcc_hard_insn"
  3377.   [(set (match_operand:SF 0 "register_operand" "=f")
  3378.     (if_then_else (match_operand 1 "comparison_operator" "")
  3379.               (match_operand:SF 2 "register_operand" "f")
  3380.               (match_operand:SF 3 "register_operand" "0")))]
  3381.   "TARGET_HARD_FLOAT"
  3382.   "mvf%d1s\\t%0, %2"
  3383.   [(set_attr "type" "ffarith")
  3384.    (set_attr "conds" "use")])
  3385.  
  3386. (define_insn "*movsfcc_soft_insn"
  3387.   [(set (match_operand:SF 0 "register_operand" "=r")
  3388.     (if_then_else (match_operand 1 "comparison_operator" "")
  3389.               (match_operand:SF 2 "register_operand" "r")
  3390.               (match_operand:SF 3 "register_operand" "0")))]
  3391.   "TARGET_SOFT_FLOAT"
  3392.   "mov%d1\\t%0, %2"
  3393.   [(set_attr "type" "*")
  3394.    (set_attr "conds" "use")])
  3395.  
  3396. (define_insn "*movdfcc_insn"
  3397.   [(set (match_operand:DF 0 "register_operand" "=f")
  3398.     (if_then_else (match_operand 1 "comparison_operator" "")
  3399.               (match_operand:DF 2 "register_operand" "f")
  3400.               (match_operand:DF 3 "register_operand" "0")))]
  3401.   "TARGET_HARD_FLOAT"
  3402.   "mvf%d1d\\t%0, %2"
  3403.   [(set_attr "type" "ffarith")
  3404.    (set_attr "conds" "use")])
  3405.  
  3406. ;; Jump and linkage insns
  3407.  
  3408. (define_insn "jump"
  3409.   [(set (pc)
  3410.     (label_ref (match_operand 0 "" "")))]
  3411.   ""
  3412.   "*
  3413. {
  3414.   extern int arm_ccfsm_state;
  3415.  
  3416.   if (arm_ccfsm_state == 1 || arm_ccfsm_state == 2)
  3417.   {
  3418.     arm_ccfsm_state += 2;
  3419.     return \"\";
  3420.   }
  3421.   return \"b%?\\t%l0\";
  3422. }")
  3423.  
  3424. (define_expand "call"
  3425.   [(parallel [(call (match_operand 0 "memory_operand" "")
  3426.                 (match_operand 1 "general_operand" ""))
  3427.           (clobber (reg:SI 14))])]
  3428.   ""
  3429.   "")
  3430.  
  3431. (define_insn ""
  3432.   [(call (mem:SI (match_operand:SI 0 "s_register_operand" "r"))
  3433.          (match_operand 1 "" "g"))
  3434.    (clobber (reg:SI 14))]
  3435.   ""
  3436.   "*
  3437.   return output_call (operands);
  3438. "
  3439. [(set (attr "conds")
  3440.       (if_then_else (eq_attr "cpu" "arm6")
  3441.             (const_string "clob")
  3442.             (const_string "nocond")))
  3443. ;; length is worst case, normally it is only two
  3444.  (set_attr "length" "12")
  3445.  (set_attr "type" "call")])
  3446.  
  3447. (define_insn ""
  3448.   [(call (mem:SI (match_operand 0 "memory_operand" "m"))
  3449.      (match_operand 1 "general_operand" "g"))
  3450.    (clobber (reg:SI 14))]
  3451.   ""
  3452.   "*
  3453.   return output_call_mem (operands);
  3454. "
  3455. [(set (attr "conds")
  3456.       (if_then_else (eq_attr "cpu" "arm6")
  3457.             (const_string "clob")
  3458.             (const_string "nocond")))
  3459.  (set_attr "length" "12")
  3460.  (set_attr "type" "call")])
  3461.  
  3462. (define_expand "call_value"
  3463.   [(parallel [(set (match_operand 0 "" "=rf")
  3464.                (call (match_operand 1 "memory_operand" "m")
  3465.                  (match_operand 2 "general_operand" "g")))
  3466.           (clobber (reg:SI 14))])]
  3467.   ""
  3468.   "")
  3469.  
  3470. (define_insn ""
  3471.   [(set (match_operand 0 "" "=rf")
  3472.         (call (mem:SI (match_operand:SI 1 "s_register_operand" "r"))
  3473.           (match_operand 2 "general_operand" "g")))
  3474.    (clobber (reg:SI 14))]
  3475.   ""
  3476.   "*
  3477.   return output_call (&operands[1]);
  3478. "
  3479. [(set (attr "conds")
  3480.       (if_then_else (eq_attr "cpu" "arm6")
  3481.             (const_string "clob")
  3482.             (const_string "nocond")))
  3483.  (set_attr "length" "12")
  3484.  (set_attr "type" "call")])
  3485.  
  3486. (define_insn ""
  3487.   [(set (match_operand 0 "" "=rf")
  3488.     (call (mem:SI (match_operand 1 "memory_operand" "m"))
  3489.     (match_operand 2 "general_operand" "g")))
  3490.    (clobber (reg:SI 14))]
  3491.   "! CONSTANT_ADDRESS_P (XEXP (operands[1], 0))"
  3492.   "*
  3493.   return output_call_mem (&operands[1]);
  3494. "
  3495. [(set (attr "conds")
  3496.       (if_then_else (eq_attr "cpu" "arm6")
  3497.             (const_string "clob")
  3498.             (const_string "nocond")))
  3499.  (set_attr "length" "12")
  3500.  (set_attr "type" "call")])
  3501.  
  3502. ;; Allow calls to SYMBOL_REFs specially as they are not valid general addresses
  3503. ;; The 'a' causes the operand to be treated as an address, i.e. no '#' output.
  3504.  
  3505. (define_insn ""
  3506.   [(call (mem:SI (match_operand:SI 0 "" "i"))
  3507.      (match_operand:SI 1 "general_operand" "g"))
  3508.    (clobber (reg:SI 14))]
  3509.   "GET_CODE (operands[0]) == SYMBOL_REF"
  3510.   "bl%?\\t%a0"
  3511. [(set (attr "conds")
  3512.       (if_then_else (eq_attr "cpu" "arm6")
  3513.             (const_string "clob")
  3514.             (const_string "nocond")))
  3515.  (set_attr "type" "call")])
  3516.  
  3517. (define_insn ""
  3518.   [(set (match_operand 0 "s_register_operand" "=rf")
  3519.     (call (mem:SI (match_operand:SI 1 "" "i"))
  3520.     (match_operand:SI 2 "general_operand" "g")))
  3521.    (clobber (reg:SI 14))]
  3522.   "GET_CODE(operands[1]) == SYMBOL_REF"
  3523.   "bl%?\\t%a1"
  3524. [(set (attr "conds")
  3525.       (if_then_else (eq_attr "cpu" "arm6")
  3526.             (const_string "clob")
  3527.             (const_string "nocond")))
  3528.  (set_attr "type" "call")])
  3529.  
  3530. ;; Often the return insn will be the same as loading from memory, so set attr
  3531. (define_insn "return"
  3532.   [(return)]
  3533.   "USE_RETURN_INSN"
  3534.   "*
  3535. {
  3536.   extern int arm_ccfsm_state;
  3537.  
  3538.   if (arm_ccfsm_state == 2)
  3539.   {
  3540.     arm_ccfsm_state += 2;
  3541.     return \"\";
  3542.   }
  3543.   return output_return_instruction (NULL, TRUE);
  3544. }"
  3545. [(set_attr "type" "load")])
  3546.  
  3547. (define_insn ""
  3548.   [(set (pc)
  3549.         (if_then_else (match_operator 0 "comparison_operator"
  3550.                [(reg 24) (const_int 0)])
  3551.                       (return)
  3552.                       (pc)))]
  3553.   "USE_RETURN_INSN"
  3554.   "*
  3555. {
  3556.   extern int arm_ccfsm_state;
  3557.  
  3558.   if (arm_ccfsm_state == 2)
  3559.   {
  3560.     arm_ccfsm_state += 2;
  3561.     return \"\";
  3562.   }
  3563.   return output_return_instruction (operands[0], TRUE);
  3564. }"
  3565. [(set_attr "conds" "use")
  3566.  (set_attr "type" "load")])
  3567.  
  3568. (define_insn ""
  3569.   [(set (pc)
  3570.         (if_then_else (match_operator 0 "comparison_operator"
  3571.                [(reg 24) (const_int 0)])
  3572.                       (pc)
  3573.               (return)))]
  3574.   "USE_RETURN_INSN"
  3575.   "*
  3576. {
  3577.   extern int arm_ccfsm_state;
  3578.  
  3579.   if (arm_ccfsm_state == 2)
  3580.   {
  3581.     arm_ccfsm_state += 2;
  3582.     return \"\";
  3583.   }
  3584.   return output_return_instruction 
  3585.     (gen_rtx (reverse_condition (GET_CODE (operands[0])),
  3586.           GET_MODE (operands[0]), XEXP (operands[0], 0),
  3587.           XEXP (operands[0], 1)),
  3588.      TRUE);
  3589. }"
  3590. [(set_attr "conds" "use")
  3591.  (set_attr "type" "load")])
  3592.  
  3593. ;; Call subroutine returning any type.
  3594.  
  3595. (define_expand "untyped_call"
  3596.   [(parallel [(call (match_operand 0 "" "")
  3597.             (const_int 0))
  3598.           (match_operand 1 "" "")
  3599.           (match_operand 2 "" "")])]
  3600.   ""
  3601.   "
  3602. {
  3603.   int i;
  3604.  
  3605.   emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
  3606.  
  3607.   for (i = 0; i < XVECLEN (operands[2], 0); i++)
  3608.     {
  3609.       rtx set = XVECEXP (operands[2], 0, i);
  3610.       emit_move_insn (SET_DEST (set), SET_SRC (set));
  3611.     }
  3612.  
  3613.   /* The optimizer does not know that the call sets the function value
  3614.      registers we stored in the result block.  We avoid problems by
  3615.      claiming that all hard registers are used and clobbered at this
  3616.      point.  */
  3617.   emit_insn (gen_blockage ());
  3618.  
  3619.   DONE;
  3620. }")
  3621.  
  3622. ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
  3623. ;; all of memory.  This blocks insns from being moved across this point.
  3624.  
  3625. (define_insn "blockage"
  3626.   [(unspec_volatile [(const_int 0)] 0)]
  3627.   ""
  3628.   ""
  3629. [(set_attr "length" "0")
  3630.  (set_attr "type" "block")])
  3631.  
  3632. (define_insn "tablejump"
  3633.   [(set (pc)
  3634.     (match_operand:SI 0 "s_register_operand" "r"))
  3635.    (use (label_ref (match_operand 1 "" "")))]
  3636.   ""
  3637.   "mov%?\\t%|pc, %0\\t%@ table jump, label %l1")
  3638.  
  3639. (define_insn ""
  3640.   [(set (pc)
  3641.     (match_operand:SI 0 "memory_operand" "m"))
  3642.    (use (label_ref (match_operand 1 "" "")))]
  3643.   ""
  3644.   "ldr%?\\t%|pc, %0\\t%@ table jump, label %l1"
  3645. [(set_attr "type" "load")])
  3646.  
  3647. (define_insn "indirect_jump"
  3648.   [(set (pc)
  3649.     (match_operand:SI 0 "s_register_operand" "r"))]
  3650.   ""
  3651.   "mov%?\\t%|pc, %0\\t%@ indirect jump")
  3652.  
  3653. (define_insn ""
  3654.   [(set (pc)
  3655.     (match_operand:SI 0 "memory_operand" "m"))]
  3656.   ""
  3657.   "ldr%?\\t%|pc, %0\\t%@ indirect jump"
  3658. [(set_attr "type" "load")])
  3659.  
  3660. ;; Misc insns
  3661.  
  3662. (define_insn "nop"
  3663.   [(const_int 0)]
  3664.   ""
  3665.   "mov%?\\tr0, r0\\t%@ nop")
  3666.  
  3667. ;; Patterns to allow combination of arithmetic, cond code and shifts
  3668.  
  3669. (define_insn ""
  3670.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  3671.         (match_operator:SI 1 "shiftable_operator"
  3672.           [(match_operator:SI 3 "shift_operator"
  3673.              [(match_operand:SI 4 "s_register_operand" "r")
  3674.               (match_operand:SI 5 "reg_or_int_operand" "rI")])
  3675.            (match_operand:SI 2 "s_register_operand" "r")]))]
  3676.   ""
  3677.   "%i1%?\\t%0, %2, %4%S3")
  3678.  
  3679. (define_insn ""
  3680.   [(set (reg:CC_NOOV 24)
  3681.         (compare:CC_NOOV (match_operator:SI 1 "shiftable_operator"
  3682.                   [(match_operator:SI 3 "shift_operator"
  3683.                     [(match_operand:SI 4 "s_register_operand" "r")
  3684.                      (match_operand:SI 5 "reg_or_int_operand" "rI")])
  3685.                    (match_operand:SI 2 "s_register_operand" "r")])
  3686.              (const_int 0)))
  3687.    (set (match_operand:SI 0 "s_register_operand" "=r")
  3688.     (match_op_dup 1 [(match_op_dup 3 [(match_dup 4) (match_dup 5)])
  3689.              (match_dup 2)]))]
  3690.   ""
  3691.   "%i1%?s\\t%0, %2, %4%S3"
  3692. [(set_attr "conds" "set")])
  3693.  
  3694. (define_insn ""
  3695.   [(set (reg:CC_NOOV 24)
  3696.         (compare:CC_NOOV (match_operator:SI 1 "shiftable_operator"
  3697.                   [(match_operator:SI 3 "shift_operator"
  3698.                     [(match_operand:SI 4 "s_register_operand" "r")
  3699.                      (match_operand:SI 5 "reg_or_int_operand" "rI")])
  3700.                    (match_operand:SI 2 "s_register_operand" "r")])
  3701.              (const_int 0)))
  3702.    (clobber (match_scratch:SI 0 "=r"))]
  3703.   ""
  3704.   "%i1%?s\\t%0, %2, %4%S3"
  3705. [(set_attr "conds" "set")])
  3706.  
  3707. (define_insn ""
  3708.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  3709.     (minus:SI (match_operand:SI 1 "s_register_operand" "r")
  3710.           (match_operator:SI 2 "shift_operator"
  3711.            [(match_operand:SI 3 "s_register_operand" "r")
  3712.             (match_operand:SI 4 "reg_or_int_operand" "rM")])))]
  3713.   ""
  3714.   "sub%?\\t%0, %1, %3%S2")
  3715.  
  3716. (define_insn ""
  3717.   [(set (reg:CC_NOOV 24)
  3718.     (compare:CC_NOOV
  3719.      (minus:SI (match_operand:SI 1 "s_register_operand" "r")
  3720.            (match_operator:SI 2 "shift_operator"
  3721.             [(match_operand:SI 3 "s_register_operand" "r")
  3722.              (match_operand:SI 4 "reg_or_int_operand" "rM")]))
  3723.      (const_int 0)))
  3724.    (set (match_operand:SI 0 "s_register_operand" "=r")
  3725.     (minus:SI (match_dup 1) (match_op_dup 2 [(match_dup 3)
  3726.                          (match_dup 4)])))]
  3727.   ""
  3728.   "sub%?s\\t%0, %1, %3%S2"
  3729. [(set_attr "conds" "set")])
  3730.  
  3731. (define_insn ""
  3732.   [(set (reg:CC_NOOV 24)
  3733.     (compare:CC_NOOV
  3734.      (minus:SI (match_operand:SI 1 "s_register_operand" "r")
  3735.            (match_operator:SI 2 "shift_operator"
  3736.             [(match_operand:SI 3 "s_register_operand" "r")
  3737.              (match_operand:SI 4 "reg_or_int_operand" "rM")]))
  3738.      (const_int 0)))
  3739.    (clobber (match_scratch:SI 0 "=r"))]
  3740.   ""
  3741.   "sub%?s\\t%0, %1, %3%S2"
  3742. [(set_attr "conds" "set")])
  3743.  
  3744. ;; These variants of the above insns can occur if the first operand is the
  3745. ;; frame pointer and we eliminate that.  This is a kludge, but there doesn't
  3746. ;; seem to be a way around it.  Most of the predicates have to be null
  3747. ;; because the format can be generated part way through reload, so
  3748. ;; if we don't match it as soon as it becomes available, reload doesn't know
  3749. ;; how to reload pseudos that haven't got hard registers; the constraints will
  3750. ;; sort everything out.
  3751.  
  3752. (define_insn ""
  3753.   [(set (match_operand:SI 0 "" "=&r")
  3754.     (plus:SI (plus:SI (match_operator:SI 5 "shift_operator"
  3755.                [(match_operand:SI 3 "" "r")
  3756.                 (match_operand:SI 4 "" "rM")])
  3757.               (match_operand:SI 2 "" "r"))
  3758.          (match_operand:SI 1 "const_int_operand" "n")))]
  3759.   "reload_in_progress"
  3760.   "*
  3761.   output_asm_insn (\"add%?\\t%0, %2, %3%S5\", operands);
  3762.   operands[2] = operands[1];
  3763.   operands[1] = operands[0];
  3764.   return output_add_immediate (operands);
  3765. "
  3766. ; we have no idea how long the add_immediate is, it could be up to 4.
  3767. [(set_attr "length" "20")])
  3768.  
  3769. (define_insn ""
  3770.   [(set (reg:CC_NOOV 24)
  3771.     (compare:CC_NOOV (plus:SI
  3772.               (plus:SI 
  3773.                (match_operator:SI 5 "shift_operator"
  3774.                 [(match_operand:SI 3 "" "r")
  3775.                  (match_operand:SI 4 "" "rM")])
  3776.                (match_operand:SI 1 "" "r"))
  3777.               (match_operand:SI 2 "const_int_operand" "n"))
  3778.              (const_int 0)))
  3779.    (set (match_operand:SI 0 "" "=&r")
  3780.     (plus:SI (plus:SI (match_op_dup 5 [(match_dup 3) (match_dup 4)])
  3781.               (match_dup 1))
  3782.          (match_dup 2)))]
  3783.   "reload_in_progress"
  3784.   "*
  3785.   output_add_immediate (operands);
  3786.   return \"add%?s\\t%0, %0, %3%S5\";
  3787. "
  3788. [(set_attr "conds" "set")
  3789.  (set_attr "length" "20")])
  3790.  
  3791. (define_insn ""
  3792.   [(set (reg:CC_NOOV 24)
  3793.     (compare:CC_NOOV (plus:SI
  3794.               (plus:SI 
  3795.                (match_operator:SI 5 "shift_operator"
  3796.                 [(match_operand:SI 3 "" "r")
  3797.                  (match_operand:SI 4 "" "rM")])
  3798.                (match_operand:SI 1 "" "r"))
  3799.               (match_operand:SI 2 "const_int_operand" "n"))
  3800.              (const_int 0)))
  3801.    (clobber (match_scratch:SI 0 "=&r"))]
  3802.   "reload_in_progress"
  3803.   "*
  3804.   output_add_immediate (operands);
  3805.   return \"add%?s\\t%0, %0, %3%S5\";
  3806. "
  3807. [(set_attr "conds" "set")
  3808.  (set_attr "length" "20")])
  3809.  
  3810. ;; These are similar, but are needed when the mla pattern contains the
  3811. ;; eliminated register as operand 3.
  3812.  
  3813. (define_insn ""
  3814.   [(set (match_operand:SI 0 "" "=&r,&r")
  3815.     (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "" "%0,r")
  3816.                    (match_operand:SI 2 "" "r,r"))
  3817.               (match_operand:SI 3 "" "r,r"))
  3818.          (match_operand:SI 4 "const_int_operand" "n,n")))]
  3819.   "reload_in_progress"
  3820.   "*
  3821.   output_asm_insn (\"mla%?\\t%0, %2, %1, %3\", operands);
  3822.   operands[2] = operands[4];
  3823.   operands[1] = operands[0];
  3824.   return output_add_immediate (operands);
  3825. "
  3826. [(set_attr "length" "20")])
  3827.  
  3828. (define_insn ""
  3829.   [(set (reg:CC_NOOV 24)
  3830.     (compare:CC_NOOV (plus:SI (plus:SI (mult:SI
  3831.                         (match_operand:SI 3 "" "r")
  3832.                         (match_operand:SI 4 "" "r"))
  3833.                        (match_operand:SI 1 "" "r"))
  3834.                   (match_operand:SI 2 "const_int_operand" "n"))
  3835.              (const_int 0)))
  3836.    (set (match_operand:SI 0 "" "=&r")
  3837.     (plus:SI (plus:SI (mult:SI (match_dup 3) (match_dup 4)) (match_dup 1))
  3838.          (match_dup 2)))]
  3839.   "reload_in_progress"
  3840.   "*
  3841.   output_add_immediate (operands);
  3842.   output_asm_insn (\"mla%?s\\t%0, %3, %4, %0\", operands);
  3843.   return \"\";
  3844. "
  3845. [(set_attr "length" "20")
  3846.  (set_attr "conds" "set")])
  3847.  
  3848. (define_insn ""
  3849.   [(set (reg:CC_NOOV 24)
  3850.     (compare:CC_NOOV (plus:SI (plus:SI (mult:SI
  3851.                         (match_operand:SI 3 "" "r")
  3852.                         (match_operand:SI 4 "" "r"))
  3853.                        (match_operand:SI 1 "" "r"))
  3854.                   (match_operand:SI 2 "const_int_operand" "n"))
  3855.              (const_int 0)))
  3856.    (clobber (match_scratch:SI 0 "=&r"))]
  3857.   "reload_in_progress"
  3858.   "*
  3859.   output_add_immediate (operands);
  3860.   return \"mla%?s\\t%0, %3, %4, %0\";
  3861. "
  3862. [(set_attr "length" "20")
  3863.  (set_attr "conds" "set")])
  3864.  
  3865.  
  3866.  
  3867.  
  3868. (define_insn ""
  3869.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  3870.     (and:SI (match_operator 1 "comparison_operator"
  3871.          [(match_operand 3 "reversible_cc_register" "") (const_int 0)])
  3872.         (match_operand:SI 2 "s_register_operand" "r")))]
  3873.   ""
  3874.   "mov%D1\\t%0, #0\;and%d1\\t%0, %2, #1"
  3875. [(set_attr "conds" "use")
  3876.  (set_attr "length" "8")])
  3877.  
  3878. (define_insn ""
  3879.   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
  3880.     (ior:SI (match_operator 2 "comparison_operator"
  3881.          [(reg 24) (const_int 0)])
  3882.         (match_operand:SI 1 "s_register_operand" "0,?r")))]
  3883.   ""
  3884.   "@
  3885.    orr%d2\\t%0, %1, #1
  3886.    mov%D2\\t%0, %1\;orr%d2\\t%0, %1, #1"
  3887. [(set_attr "conds" "use")
  3888.  (set_attr "length" "4,8")])
  3889.  
  3890. (define_insn ""
  3891.   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
  3892.     (match_operator 1 "comparison_operator"
  3893.      [(match_operand:SI 2 "s_register_operand" "r,r")
  3894.       (match_operand:SI 3 "arm_add_operand" "rI,L")]))
  3895.    (clobber (reg 24))]
  3896.   ""
  3897.   "*
  3898.   if (GET_CODE (operands[1]) == LT && operands[3] == const0_rtx)
  3899.     return \"mov\\t%0, %2, lsr #31\";
  3900.  
  3901.   if (GET_CODE (operands[1]) == GE && operands[3] == const0_rtx)
  3902.     return \"mvn\\t%0, %2\;mov\\t%0, %0, lsr #31\";
  3903.  
  3904.   if (GET_CODE (operands[1]) == NE)
  3905.     {
  3906.       if (which_alternative == 1)
  3907.     return \"adds\\t%0, %2, #%n3\;movne\\t%0, #1\";
  3908.       return \"subs\\t%0, %2, %3\;movne\\t%0, #1\";
  3909.     }
  3910.   if (which_alternative == 1)
  3911.     output_asm_insn (\"cmn\\t%2, #%n3\", operands);
  3912.   else
  3913.     output_asm_insn (\"cmp\\t%2, %3\", operands);
  3914.   return \"mov%D1\\t%0, #0\;mov%d1\\t%0, #1\";
  3915. "
  3916. [(set_attr "conds" "clob")
  3917.  (set_attr "length" "12")])
  3918.  
  3919. (define_insn ""
  3920.   [(set (match_operand:SI 0 "s_register_operand" "=&r")
  3921.     (ior:SI (match_operator 1 "comparison_operator"
  3922.          [(match_operand:SI 2 "s_register_operand" "r")
  3923.           (match_operand:SI 3 "arm_rhs_operand" "rI")])
  3924.         (match_operator 4 "comparison_operator"
  3925.          [(match_operand:SI 5 "s_register_operand" "r")
  3926.           (match_operand:SI 6 "arm_rhs_operand" "rI")])))
  3927.    (clobber (reg 24))]
  3928.   ""
  3929.   "*
  3930. {
  3931.   int dominant = comparison_dominates_p (GET_CODE (operands[4]),
  3932.                      GET_CODE (operands[1]));
  3933.  
  3934.   output_asm_insn (dominant ? \"cmp\\t%5, %6\" : \"cmp\\t%2, %3\",
  3935.            operands);
  3936.   output_asm_insn (\"mov\\t%0, #0\", operands);
  3937.   if (GET_CODE (operands[1]) == GET_CODE (operands[4])
  3938.       || comparison_dominates_p (GET_CODE (operands[1]),
  3939.                  GET_CODE (operands[4]))
  3940.       || dominant)
  3941.     output_asm_insn (dominant ? \"cmp%D4\\t%2, %3\" : \"cmp%D1\\t%5,%6\",
  3942.              operands);
  3943.   else
  3944.     output_asm_insn (\"mov%d1\\t%0, #1\;cmp\\t%5, %6\", operands);
  3945.   return dominant ? \"mov%d1\\t%0, #1\" : \"mov%d4\\t%0, #1\";
  3946. }
  3947. "
  3948. [(set_attr "conds" "clob")
  3949. ; worst case length
  3950.  (set_attr "length" "20")])
  3951.  
  3952. (define_split
  3953.   [(set (pc)
  3954.     (if_then_else
  3955.      (match_operator 5 "equality_operator"
  3956.       [(ior:SI (match_operator 6 "comparison_operator"
  3957.             [(match_operand:SI 0 "s_register_operand" "")
  3958.              (match_operand:SI 1 "arm_add_operand" "")])
  3959.            (match_operator 7 "comparison_operator"
  3960.             [(match_operand:SI 2 "s_register_operand" "")
  3961.              (match_operand:SI 3 "arm_add_operand" "")]))
  3962.       (const_int 0)])
  3963.      (label_ref (match_operand 4 "" ""))
  3964.      (pc)))
  3965.    (clobber (reg 24))]
  3966.   "(GET_CODE (operands[6]) == GET_CODE (operands[7])
  3967.     || comparison_dominates_p (GET_CODE (operands[6]), GET_CODE (operands[7]))
  3968.     || comparison_dominates_p (GET_CODE (operands[7]), GET_CODE (operands[6])))"
  3969.   [(set (reg:CC 24)
  3970.     (compare:CC (ior:CC (match_op_dup 6
  3971.                  [(match_dup 0) (match_dup 1)])
  3972.                 (match_op_dup 7
  3973.                  [(match_dup 2) (match_dup 3)]))
  3974.             (const_int 0)))
  3975.    (set (pc)
  3976.         (if_then_else (match_op_dup 5 [(reg:CC 24) (const_int 0)])
  3977.               (label_ref (match_dup 4))
  3978.               (pc)))]
  3979.   "
  3980. {
  3981.   enum rtx_code code = comparison_dominates_p (GET_CODE (operands[6]),
  3982.                            GET_CODE (operands[7]))
  3983.                ? GET_CODE (operands[7]) : GET_CODE (operands[6]);
  3984.  
  3985.   if (GET_CODE (operands[5]) == NE)
  3986.     operands[5] = gen_rtx (code, CCmode,
  3987.                XEXP (operands[5], 0), XEXP (operands[5], 1));
  3988.   else
  3989.     operands[5] = gen_rtx (reverse_condition (code), CCmode,
  3990.                XEXP (operands[5], 0), XEXP (operands[5], 1));
  3991. }
  3992. ")
  3993.  
  3994. ;; Don't match these patterns if we can use a conditional compare, since they
  3995. ;; tell the final prescan branch eliminator code that full branch inlining
  3996. ;; can't be done.
  3997.  
  3998. (define_insn ""
  3999.   [(set (pc)
  4000.     (if_then_else
  4001.      (ne (ior:SI (match_operator 5 "comparison_operator"
  4002.               [(match_operand:SI 0 "s_register_operand" "r,r,r,r")
  4003.                (match_operand:SI 1 "arm_add_operand" "rI,L,rI,L")])
  4004.              (match_operator 6 "comparison_operator"
  4005.               [(match_operand:SI 2 "s_register_operand" "r,r,r,r")
  4006.                (match_operand:SI 3 "arm_rhs_operand" "rI,rI,L,L")]))
  4007.          (const_int 0))
  4008.      (label_ref (match_operand 4 "" ""))
  4009.      (pc)))
  4010.    (clobber (reg 24))]
  4011.   "!(GET_CODE (operands[5]) == GET_CODE (operands[6])
  4012.      || comparison_dominates_p (GET_CODE (operands[5]), GET_CODE (operands[6]))
  4013.      || comparison_dominates_p (GET_CODE (operands[6]), GET_CODE (operands[5])))"
  4014.   "*
  4015. {
  4016.   extern int arm_ccfsm_state;
  4017.  
  4018.   if (which_alternative & 1)
  4019.     output_asm_insn (\"cmn\\t%0, #%n1\;b%d5\\t%l4\", operands);
  4020.   else
  4021.     output_asm_insn (\"cmp\\t%0, %1\;b%d5\\t%l4\", operands);
  4022.  
  4023.   if (which_alternative >= 2)
  4024.     output_asm_insn (\"cmn\\t%2, #%n3\", operands);
  4025.   else
  4026.     output_asm_insn (\"cmp\\t%2, %3\", operands);
  4027.  
  4028.   if (arm_ccfsm_state == 1 || arm_ccfsm_state == 2)
  4029.   {
  4030.     arm_ccfsm_state += 2;
  4031.     return \"\";
  4032.   }
  4033.   return \"b%d6\\t%l4\";
  4034. }"
  4035. [(set_attr "conds" "jump_clob")
  4036.  (set_attr "length" "16")])
  4037.  
  4038. (define_insn ""
  4039.   [(set (reg:CC 24)
  4040.     (compare:CC
  4041.      (ior:CC (match_operator 4 "comparison_operator"
  4042.           [(match_operand:SI 0 "s_register_operand" "r,r,r,r")
  4043.            (match_operand:SI 1 "arm_add_operand" "rI,L,rI,L")])
  4044.          (match_operator 5 "comparison_operator"
  4045.           [(match_operand:SI 2 "s_register_operand" "r,r,r,r")
  4046.            (match_operand:SI 3 "arm_add_operand" "rI,rI,L,L")]))
  4047.      (const_int 0)))]
  4048.   "(GET_CODE (operands[4]) == GET_CODE (operands[5])
  4049.     || comparison_dominates_p (GET_CODE (operands[4]), GET_CODE (operands[5]))
  4050.     || comparison_dominates_p (GET_CODE (operands[5]), GET_CODE (operands[4])))"
  4051.   "*
  4052.   if (comparison_dominates_p (GET_CODE (operands[5]), GET_CODE (operands[4])))
  4053.     {
  4054.       if (which_alternative >= 2)
  4055.     output_asm_insn (\"cmn\\t%2, #%n3\", operands);
  4056.       else
  4057.     output_asm_insn (\"cmp\\t%2, %3\", operands);
  4058.  
  4059.       if (which_alternative & 1)
  4060.     return \"cmn%D5\\t%0, #%n1\";
  4061.       return \"cmp%D5\\t%0, %1\";
  4062.     }
  4063.  
  4064.   if (which_alternative & 1)
  4065.     output_asm_insn (\"cmn\\t%0, #%n1\", operands);
  4066.   else
  4067.     output_asm_insn (\"cmp\\t%0, %1\", operands);
  4068.  
  4069.   if (which_alternative >= 2)
  4070.     return \"cmn%D4\\t%2, #%n3\";
  4071.   return \"cmp%D4\\t%2, %3\";
  4072. "
  4073. [(set_attr "conds" "set")
  4074.  (set_attr "length" "8")])
  4075.  
  4076. (define_insn ""
  4077.   [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
  4078.     (if_then_else (match_operator 3 "equality_operator"
  4079.                [(match_operator 4 "comparison_operator"
  4080.              [(reg 24) (const_int 0)])
  4081.             (const_int 0)])
  4082.               (match_operand:SI 1 "arm_rhs_operand" "0,rI,?rI")
  4083.               (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI")))]
  4084.   ""
  4085.   "*
  4086.   if (GET_CODE (operands[3]) == NE)
  4087.     {
  4088.       if (which_alternative != 1)
  4089.     output_asm_insn (\"mov%D4\\t%0, %2\", operands);
  4090.       if (which_alternative != 0)
  4091.     output_asm_insn (\"mov%d4\\t%0, %1\", operands);
  4092.       return \"\";
  4093.     }
  4094.   if (which_alternative != 0)
  4095.     output_asm_insn (\"mov%D4\\t%0, %1\", operands);
  4096.   if (which_alternative != 1)
  4097.     output_asm_insn (\"mov%d4\\t%0, %2\", operands);
  4098.   return \"\";
  4099. "
  4100. [(set_attr "conds" "use")
  4101.  (set_attr "length" "4,4,8")])
  4102.  
  4103. (define_insn ""
  4104.   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
  4105.         (match_operator:SI 5 "shiftable_operator" 
  4106.      [(match_operator:SI 4 "comparison_operator"
  4107.            [(match_operand:SI 2 "s_register_operand" "r,r")
  4108.         (match_operand:SI 3 "arm_rhs_operand" "rI,rI")])
  4109.           (match_operand:SI 1 "s_register_operand" "0,?r")]))
  4110.    (clobber (reg 24))]
  4111.   ""
  4112.   "*
  4113.   if (GET_CODE (operands[4]) == LT && operands[3] == const0_rtx)
  4114.     return \"%i5\\t%0, %1, %2, lsr #31\";
  4115.  
  4116.   output_asm_insn (\"cmp\\t%2, %3\", operands);
  4117.   if (GET_CODE (operands[5]) == AND)
  4118.     output_asm_insn (\"mov%D4\\t%0, #0\", operands);
  4119.   else if (which_alternative != 0)
  4120.     output_asm_insn (\"mov%D4\\t%0, %1\", operands);
  4121.   return \"%i5%d4\\t%0, %1, #1\";
  4122. "
  4123. [(set_attr "conds" "clob")
  4124.  (set_attr "length" "12")])
  4125.  
  4126. (define_insn ""
  4127.   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
  4128.         (minus:SI (match_operand:SI 1 "s_register_operand" "0,?r")
  4129.           (match_operator:SI 4 "comparison_operator"
  4130.                    [(match_operand:SI 2 "s_register_operand" "r,r")
  4131.             (match_operand:SI 3 "arm_rhs_operand" "rI,rI")])))
  4132.    (clobber (reg 24))]
  4133.   ""
  4134.   "*
  4135.   output_asm_insn (\"cmp\\t%2, %3\", operands);
  4136.   if (which_alternative != 0)
  4137.     output_asm_insn (\"mov%D4\\t%0, %1\", operands);
  4138.   return \"sub%d4\\t%0, %1, #1\";
  4139. "
  4140. [(set_attr "conds" "clob")
  4141.  (set_attr "length" "8,12")])
  4142.  
  4143. (define_insn ""
  4144.   [(set (match_operand:SI 0 "s_register_operand" "=&r")
  4145.     (and:SI (match_operator 1 "comparison_operator"
  4146.          [(match_operand:SI 2 "s_register_operand" "r")
  4147.           (match_operand:SI 3 "arm_rhs_operand" "rI")])
  4148.         (match_operator 4 "comparison_operator"
  4149.          [(match_operand:SI 5 "s_register_operand" "r")
  4150.           (match_operand:SI 6 "arm_rhs_operand" "rI")])))
  4151.    (clobber (reg 24))]
  4152.   ""
  4153.   "*
  4154. {
  4155.   int dominant =
  4156.     comparison_dominates_p (reverse_condition (GET_CODE (operands[1])),
  4157.                 reverse_condition (GET_CODE (operands[4])))
  4158.     ? 1 
  4159.     : comparison_dominates_p (reverse_condition (GET_CODE (operands[4])),
  4160.                   reverse_condition (GET_CODE (operands[1])))
  4161.     ? 2 : 0;
  4162.   output_asm_insn (dominant == 2 ? \"cmp\\t%5, %6\" : \"cmp\\t%2, %3\",
  4163.                operands);
  4164.   output_asm_insn (\"mov\\t%0, #1\", operands);
  4165.   if (GET_CODE (operands[1]) == GET_CODE (operands[4]) || dominant)
  4166.     {
  4167.       output_asm_insn (dominant == 2 ? \"cmp%d4\\t%2, %3\"
  4168.                : \"cmp%d1\\t%5, %6\", operands);
  4169.     }
  4170.   else
  4171.     {
  4172.       output_asm_insn (\"mov%D1\\t%0, #0\", operands);
  4173.       output_asm_insn (\"cmp\\t%5, %6\", operands);
  4174.     }
  4175.   return dominant == 2 ? \"mov%D1\\t%0, #0\" : \"mov%D4\\t%0, #0\";
  4176. }
  4177. "
  4178. [(set_attr "conds" "clob")
  4179.  (set_attr "length" "20")])
  4180.  
  4181. (define_split
  4182.   [(set (pc)
  4183.     (if_then_else (match_operator 1 "equality_operator"
  4184.                [(and:SI (match_operator 2 "comparison_operator"
  4185.                  [(match_operand:SI 3 "s_register_operand" "")
  4186.                   (match_operand:SI 4 "arm_add_operand" "")])
  4187.                 (match_operator 0 "comparison_operator"
  4188.                  [(match_operand:SI 5 "s_register_operand" "")
  4189.                   (match_operand:SI 6 "arm_add_operand" "")]))
  4190.             (const_int 0)])
  4191.               (label_ref (match_operand 7 "" ""))
  4192.               (pc)))
  4193.    (clobber (reg 24))]
  4194.   "(GET_CODE (operands[2]) == GET_CODE (operands[0])
  4195.     || comparison_dominates_p (reverse_condition (GET_CODE (operands[2])),
  4196.                    reverse_condition (GET_CODE (operands[0])))
  4197.     || comparison_dominates_p (reverse_condition (GET_CODE (operands[0])),
  4198.                    reverse_condition (GET_CODE (operands[2]))))"
  4199.   [(set (reg:CC 24)
  4200.     (compare:CC (ior:CC (match_op_dup 2
  4201.                  [(match_dup 3) (match_dup 4)])
  4202.                 (match_op_dup 0
  4203.                  [(match_dup 5) (match_dup 6)]))
  4204.             (const_int 0)))
  4205.    (set (pc)
  4206.         (if_then_else (match_op_dup 1 [(reg:CC 24) (const_int 0)])
  4207.               (label_ref (match_dup 7))
  4208.               (pc)))]
  4209.   "
  4210. {
  4211.   /* Use DeMorgans law to convert this into an IOR of the inverse conditions 
  4212.      This is safe since we only do it for integer comparisons. */
  4213.   enum rtx_code code = 
  4214.     comparison_dominates_p (reverse_condition (GET_CODE (operands[2])),
  4215.                 reverse_condition (GET_CODE (operands[0])))
  4216.     ? GET_CODE (operands[0]) : GET_CODE (operands[2]);
  4217.  
  4218.   operands[2] = gen_rtx (reverse_condition (GET_CODE (operands[2])),
  4219.              GET_MODE (operands[2]), operands[3], operands[4]);
  4220.   operands[0] = gen_rtx (reverse_condition (GET_CODE (operands[0])),
  4221.              GET_MODE (operands[0]), operands[5], operands[6]);
  4222.   if (GET_CODE (operands[1]) == NE)
  4223.     operands[1] = gen_rtx (code, CCmode,
  4224.                XEXP (operands[1], 0), XEXP (operands[1], 1));
  4225.   else
  4226.     operands[1] = gen_rtx (reverse_condition (code), CCmode,
  4227.                XEXP (operands[1], 0), XEXP (operands[1], 1));
  4228. }
  4229. ")
  4230.  
  4231. ;; Don't match these patterns if we can use a conditional compare, since they
  4232. ;; tell the final prescan branch eliminator code that full branch inlining
  4233. ;; can't be done.
  4234.  
  4235. (define_insn ""
  4236.   [(set (pc)
  4237.     (if_then_else
  4238.      (eq (and:SI (match_operator 1 "comparison_operator"
  4239.               [(match_operand:SI 2 "s_register_operand" "r,r,r,r")
  4240.                (match_operand:SI 3 "arm_add_operand" "rI,L,rI,L")])
  4241.              (match_operator 4 "comparison_operator"
  4242.               [(match_operand:SI 5 "s_register_operand" "r,r,r,r")
  4243.                (match_operand:SI 6 "arm_rhs_operand" "rI,rI,L,L")]))
  4244.          (const_int 0))
  4245.      (label_ref (match_operand 0 "" ""))
  4246.      (pc)))
  4247.    (clobber (reg 24))]
  4248.   "!(GET_CODE (operands[1]) == GET_CODE (operands[4])
  4249.      || comparison_dominates_p (reverse_condition (GET_CODE (operands[1])),
  4250.                     reverse_condition (GET_CODE (operands[4])))
  4251.      || comparison_dominates_p (reverse_condition (GET_CODE (operands[4])),
  4252.                     reverse_condition (GET_CODE (operands[1]))))"
  4253.   "*
  4254. {
  4255.   extern int arm_ccfsm_state;
  4256.  
  4257.   if (which_alternative & 1)
  4258.     output_asm_insn (\"cmn\\t%2, #%n3\;b%D1\\t%l0\", operands);
  4259.   else
  4260.     output_asm_insn (\"cmp\\t%2, %3\;b%D1\\t%l0\", operands);
  4261.  
  4262.   if (which_alternative >= 2)
  4263.     output_asm_insn (\"cmn\\t%5, #%n6\", operands);
  4264.   else
  4265.     output_asm_insn (\"cmp\\t%5, %6\", operands);
  4266.  
  4267.   if (arm_ccfsm_state == 1 || arm_ccfsm_state == 2)
  4268.   {
  4269.     arm_ccfsm_state += 2;
  4270.     return \"\";
  4271.   }
  4272.   return \"b%D4\\t%l0\";
  4273. }"
  4274. [(set_attr "conds" "jump_clob")
  4275.  (set_attr "length" "16")])
  4276.  
  4277. (define_insn ""
  4278.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  4279.     (neg:SI (match_operator 3 "comparison_operator"
  4280.          [(match_operand:SI 1 "s_register_operand" "r")
  4281.           (match_operand:SI 2 "arm_rhs_operand" "rI")])))
  4282.    (clobber (reg 24))]
  4283.   ""
  4284.   "*
  4285.   if (GET_CODE (operands[3]) == LT && operands[3] == const0_rtx)
  4286.     return \"mov\\t%0, %1, asr #31\";
  4287.  
  4288.   if (GET_CODE (operands[3]) == NE)
  4289.     return \"subs\\t%0, %1, %2\;mvnne\\t%0, #0\";
  4290.  
  4291.   if (GET_CODE (operands[3]) == GT)
  4292.     return \"subs\\t%0, %1, %2\;mvnne\\t%0, %0, asr #31\";
  4293.  
  4294.   output_asm_insn (\"cmp\\t%1, %2\", operands);
  4295.   output_asm_insn (\"mov%D3\\t%0, #0\", operands);
  4296.   return \"mvn%d3\\t%0, #0\";
  4297. "
  4298. [(set_attr "conds" "clob")
  4299.  (set_attr "length" "12")])
  4300.  
  4301. (define_insn "movcond"
  4302.   [(set (match_operand:SI 0 "s_register_operand" "=r,r,r")
  4303.     (if_then_else:SI
  4304.      (match_operator 5 "comparison_operator"
  4305.       [(match_operand:SI 3 "s_register_operand" "r,r,r")
  4306.        (match_operand:SI 4 "arm_add_operand" "rIL,rIL,rIL")])
  4307.      (match_operand:SI 1 "arm_rhs_operand" "0,rI,?rI")
  4308.      (match_operand:SI 2 "arm_rhs_operand" "rI,0,rI")))
  4309.    (clobber (reg 24))]
  4310.   ""
  4311.   "*
  4312.   if (GET_CODE (operands[5]) == LT
  4313.       && (operands[4] == const0_rtx))
  4314.     {
  4315.       if (which_alternative != 1 && GET_CODE (operands[1]) == REG)
  4316.     {
  4317.       if (operands[2] == const0_rtx)
  4318.         return \"and\\t%0, %1, %3, asr #31\";
  4319.       return \"ands\\t%0, %1, %3, asr #32\;movcc\\t%0, %2\";
  4320.     }
  4321.       else if (which_alternative != 0 && GET_CODE (operands[2]) == REG)
  4322.     {
  4323.       if (operands[1] == const0_rtx)
  4324.         return \"bic\\t%0, %2, %3, asr #31\";
  4325.       return \"bics\\t%0, %2, %3, asr #32\;movcs\\t%0, %1\";
  4326.     }
  4327.       /* The only case that falls through to here is when both ops 1 & 2
  4328.      are constants */
  4329.     }
  4330.  
  4331.   if (GET_CODE (operands[5]) == GE
  4332.       && (operands[4] == const0_rtx))
  4333.     {
  4334.       if (which_alternative != 1 && GET_CODE (operands[1]) == REG)
  4335.     {
  4336.       if (operands[2] == const0_rtx)
  4337.         return \"bic\\t%0, %1, %3, asr #31\";
  4338.       return \"bics\\t%0, %1, %3, asr #32\;movcs\\t%0, %2\";
  4339.     }
  4340.       else if (which_alternative != 0 && GET_CODE (operands[2]) == REG)
  4341.     {
  4342.       if (operands[1] == const0_rtx)
  4343.         return \"and\\t%0, %2, %3, asr #31\";
  4344.       return \"ands\\t%0, %2, %3, asr #32\;movcc\\t%0, %1\";
  4345.     }
  4346.       /* The only case that falls through to here is when both ops 1 & 2
  4347.      are constants */
  4348.     }
  4349.   if (GET_CODE (operands[4]) == CONST_INT
  4350.       && !const_ok_for_arm (INTVAL (operands[4])))
  4351.     output_asm_insn (\"cmn\\t%3, #%n4\", operands);
  4352.   else
  4353.     output_asm_insn (\"cmp\\t%3, %4\", operands);
  4354.   if (which_alternative != 0)
  4355.     output_asm_insn (\"mov%d5\\t%0, %1\", operands);
  4356.   if (which_alternative != 1)
  4357.     output_asm_insn (\"mov%D5\\t%0, %2\", operands);
  4358.   return \"\";
  4359. "
  4360. [(set_attr "conds" "clob")
  4361.  (set_attr "length" "8,8,12")])
  4362.  
  4363. (define_insn ""
  4364.   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
  4365.     (if_then_else:SI (match_operator 9 "comparison_operator"
  4366.               [(match_operand:SI 5 "s_register_operand" "r,r")
  4367.                (match_operand:SI 6 "arm_add_operand" "rI,L")])
  4368.              (match_operator:SI 8 "shiftable_operator"
  4369.               [(match_operand:SI 1 "s_register_operand" "r,r")
  4370.                (match_operand:SI 2 "arm_rhs_operand" "rI,rI")])
  4371.              (match_operator:SI 7 "shiftable_operator"
  4372.               [(match_operand:SI 3 "s_register_operand" "r,r")
  4373.                (match_operand:SI 4 "arm_rhs_operand" "rI,rI")])))
  4374.    (clobber (reg 24))]
  4375.   ""
  4376.   "@
  4377.    cmp\\t%5, %6\;%I8%d9\\t%0, %1, %2\;%I7%D9\\t%0, %3, %4
  4378.    cmn\\t%5, #%n6\;%I8%d9\\t%0, %1, %2\;%I7%D9\\t%0, %3, %4"
  4379. [(set_attr "conds" "clob")
  4380.  (set_attr "length" "12")])
  4381.  
  4382. (define_insn ""
  4383.   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
  4384.     (if_then_else:SI (match_operator 6 "comparison_operator"
  4385.               [(match_operand:SI 2 "s_register_operand" "r,r")
  4386.                (match_operand:SI 3 "arm_add_operand" "rIL,rIL")])
  4387.              (match_operator:SI 7 "shiftable_operator"
  4388.               [(match_operand:SI 4 "s_register_operand" "r,r")
  4389.                (match_operand:SI 5 "arm_rhs_operand" "rI,rI")])
  4390.              (match_operand:SI 1 "arm_rhsm_operand" "0,?rIm")))
  4391.    (clobber (reg 24))]
  4392.   ""
  4393.   "*
  4394.   /* If we have an operation where (op x 0) is the identity operation and
  4395.      the conditional operator is LT or GE and we are comparing against zero and
  4396.      everything is in registers then we can do this in two instructions */
  4397.   if (operands[3] == const0_rtx
  4398.       && GET_CODE (operands[7]) != AND
  4399.       && GET_CODE (operands[5]) == REG
  4400.       && GET_CODE (operands[1]) == REG 
  4401.       && REGNO (operands[1]) == REGNO (operands[4])
  4402.       && REGNO (operands[4]) != REGNO (operands[0]))
  4403.     {
  4404.       if (GET_CODE (operands[6]) == LT)
  4405.     return \"and\\t%0, %5, %2, asr #31\;%I7\\t%0, %4, %0\";
  4406.       else if (GET_CODE (operands[6]) == GE)
  4407.     return \"bic\\t%0, %5, %2, asr #31\;%I7\\t%0, %4, %0\";
  4408.     }
  4409.   if (GET_CODE (operands[3]) == CONST_INT
  4410.       && !const_ok_for_arm (INTVAL (operands[3])))
  4411.     output_asm_insn (\"cmn\\t%2, #%n3\", operands);
  4412.   else
  4413.     output_asm_insn (\"cmp\\t%2, %3\", operands);
  4414.   output_asm_insn (\"%I7%d6\\t%0, %4, %5\", operands);
  4415.   if (which_alternative != 0)
  4416.     {
  4417.       if (GET_CODE (operands[1]) == MEM)
  4418.     return \"ldr%D6\\t%0, %1\";
  4419.       else
  4420.     return \"mov%D6\\t%0, %1\";
  4421.     }
  4422.   return \"\";
  4423. "
  4424. [(set_attr "conds" "clob")
  4425.  (set_attr "length" "8,12")])
  4426.  
  4427. (define_insn ""
  4428.   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
  4429.     (if_then_else:SI (match_operator 6 "comparison_operator"
  4430.               [(match_operand:SI 4 "s_register_operand" "r,r")
  4431.                (match_operand:SI 5 "arm_add_operand" "rIL,rIL")])
  4432.              (match_operand:SI 1 "arm_rhsm_operand" "0,?rIm")
  4433.              (match_operator:SI 7 "shiftable_operator"
  4434.               [(match_operand:SI 2 "s_register_operand" "r,r")
  4435.                (match_operand:SI 3 "arm_rhs_operand" "rI,rI")])))
  4436.    (clobber (reg 24))]
  4437.   ""
  4438.   "*
  4439.   /* If we have an operation where (op x 0) is the identity operation and
  4440.      the conditional operator is LT or GE and we are comparing against zero and
  4441.      everything is in registers then we can do this in two instructions */
  4442.   if (operands[5] == const0_rtx
  4443.       && GET_CODE (operands[7]) != AND
  4444.       && GET_CODE (operands[3]) == REG
  4445.       && GET_CODE (operands[1]) == REG 
  4446.       && REGNO (operands[1]) == REGNO (operands[2])
  4447.       && REGNO (operands[2]) != REGNO (operands[0]))
  4448.     {
  4449.       if (GET_CODE (operands[6]) == GE)
  4450.     return \"and\\t%0, %3, %4, asr #31\;%I7\\t%0, %2, %0\";
  4451.       else if (GET_CODE (operands[6]) == LT)
  4452.     return \"bic\\t%0, %3, %4, asr #31\;%I7\\t%0, %2, %0\";
  4453.     }
  4454.  
  4455.   if (GET_CODE (operands[5]) == CONST_INT
  4456.       && !const_ok_for_arm (INTVAL (operands[5])))
  4457.     output_asm_insn (\"cmn\\t%4, #%n5\", operands);
  4458.   else
  4459.     output_asm_insn (\"cmp\\t%4, %5\", operands);
  4460.  
  4461.   if (which_alternative != 0)
  4462.     {
  4463.       if (GET_CODE (operands[1]) == MEM)
  4464.     output_asm_insn (\"ldr%d6\\t%0, %1\", operands);
  4465.       else
  4466.     output_asm_insn (\"mov%d6\\t%0, %1\", operands);
  4467.     }
  4468.   return \"%I7%D6\\t%0, %2, %3\";
  4469. "
  4470. [(set_attr "conds" "clob")
  4471.  (set_attr "length" "8,12")])
  4472.  
  4473. (define_insn ""
  4474.   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
  4475.     (if_then_else:SI (match_operator 6 "comparison_operator"
  4476.               [(match_operand:SI 4 "s_register_operand" "r,r")
  4477.                (match_operand:SI 5 "arm_add_operand" "rIL,rIL")])
  4478.              (plus:SI
  4479.               (match_operand:SI 2 "s_register_operand" "r,r")
  4480.               (match_operand:SI 3 "arm_add_operand" "rL,rL"))
  4481.              (match_operand:SI 1 "arm_rhsm_operand" "0,?rIm")))
  4482.    (clobber (reg 24))]
  4483.   ""
  4484.   "*
  4485. {
  4486.   if (GET_CODE (operands[5]) == CONST_INT
  4487.       && !const_ok_for_arm (INTVAL (operands[5])))
  4488.     output_asm_insn (\"cmn\\t%4, #%n5\", operands);
  4489.   else
  4490.     output_asm_insn (\"cmp\\t%4, %5\", operands);
  4491.   if (GET_CODE (operands[3]) == CONST_INT
  4492.       && !const_ok_for_arm (INTVAL (operands[3])))
  4493.     output_asm_insn (\"sub%d6\\t%0, %2, #%n3\", operands);
  4494.   else
  4495.     output_asm_insn (\"add%d6\\t%0, %2, %3\", operands);
  4496.   if (which_alternative != 0)
  4497.     {
  4498.       if (GET_CODE (operands[1]) == MEM)
  4499.     output_asm_insn (\"ldr%D6\\t%0, %1\", operands);
  4500.       else
  4501.     output_asm_insn (\"mov%D6\\t%0, %1\", operands);
  4502.     }
  4503.   return \"\";
  4504. }
  4505. "
  4506. [(set_attr "conds" "clob")
  4507.  (set_attr "length" "8,12")])
  4508.  
  4509. (define_insn ""
  4510.   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
  4511.     (if_then_else:SI (match_operator 6 "comparison_operator"
  4512.               [(match_operand:SI 4 "s_register_operand" "r,r")
  4513.                (match_operand:SI 5 "arm_add_operand" "rIL,rIL")])
  4514.              (match_operand:SI 1 "arm_rhsm_operand" "0,?rIm")
  4515.              (plus:SI
  4516.               (match_operand:SI 2 "s_register_operand" "r,r")
  4517.               (match_operand:SI 3 "arm_add_operand" "rIL,rIL"))))
  4518.    (clobber (reg 24))]
  4519.   ""
  4520.   "*
  4521. {
  4522.   if (GET_CODE (operands[5]) == CONST_INT
  4523.       && !const_ok_for_arm (INTVAL (operands[5])))
  4524.     output_asm_insn (\"cmn\\t%4, #%n5\", operands);
  4525.   else
  4526.     output_asm_insn (\"cmp\\t%4, %5\", operands);
  4527.   if (GET_CODE (operands[3]) == CONST_INT
  4528.       && !const_ok_for_arm (INTVAL (operands[3])))
  4529.     output_asm_insn (\"sub%D6\\t%0, %2, #%n3\", operands);
  4530.   else
  4531.     output_asm_insn (\"add%D6\\t%0, %2, %3\", operands);
  4532.   if (which_alternative != 0)
  4533.     {
  4534.       if (GET_CODE (operands[6]) == MEM)
  4535.     output_asm_insn (\"ldr%d6\\t%0, %1\", operands);
  4536.       else
  4537.     output_asm_insn (\"mov%d6\\t%0, %1\", operands);
  4538.     }
  4539.   return \"\";
  4540. }
  4541. "
  4542. [(set_attr "conds" "clob")
  4543.  (set_attr "length" "8,12")])
  4544.  
  4545. (define_insn ""
  4546.   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
  4547.     (if_then_else:SI (match_operator 5 "comparison_operator"
  4548.               [(match_operand:SI 3 "s_register_operand" "r,r")
  4549.                (match_operand:SI 4 "arm_add_operand" "rIL,rIL")])
  4550.              (match_operand:SI 1 "arm_rhs_operand" "0,?rI")
  4551.              (not:SI
  4552.               (match_operand:SI 2 "s_register_operand" "r,r"))))
  4553.    (clobber (reg 24))]
  4554.   ""
  4555.   "#"
  4556. [(set_attr "conds" "clob")
  4557.  (set_attr "length" "8,12")])
  4558.  
  4559. (define_insn ""
  4560.   [(set (match_operand:SI 0 "s_register_operand" "=r,r,r,r")
  4561.     (if_then_else:SI 
  4562.      (match_operator 5 "comparison_operator"
  4563.       [(match_operand:SI 3 "s_register_operand" "r,r,r,r")
  4564.        (match_operand:SI 4 "arm_add_operand" "rI,L,rI,L")])
  4565.      (not:SI
  4566.       (match_operand:SI 2 "s_register_operand" "r,r,r,r"))
  4567.      (match_operand:SI 1 "arm_rhs_operand" "0,0,?rI,?rI")))
  4568.    (clobber (reg 24))]
  4569.   ""
  4570.   "@
  4571.    cmp\\t%3, %4\;mvn%d5\\t%0, %2
  4572.    cmn\\t%3, #%n4\;mvn%d5\\t%0, %2
  4573.    cmp\\t%3, %4\;mov%D5\\t%0, %1\;mvn%d5\\t%0, %2
  4574.    cmn\\t%3, #%n4\;mov%D5\\t%0, %1\;mvn%d5\\t%0, %2"
  4575. [(set_attr "conds" "clob")
  4576.  (set_attr "length" "8,8,12,12")])
  4577.  
  4578. (define_insn ""
  4579.   [(set (match_operand:SI 0 "s_register_operand" "=r,r,r,r")
  4580.     (if_then_else:SI
  4581.      (match_operator 6 "comparison_operator"
  4582.       [(match_operand:SI 4 "s_register_operand" "r,r,r,r")
  4583.        (match_operand:SI 5 "arm_add_operand" "rI,L,rI,L")])
  4584.      (match_operator:SI 7 "shift_operator"
  4585.       [(match_operand:SI 2 "s_register_operand" "r,r,r,r")
  4586.        (match_operand:SI 3 "arm_rhs_operand" "rM,rM,rM,rM")])
  4587.      (match_operand:SI 1 "arm_rhs_operand" "0,0,?rI,?rI")))
  4588.    (clobber (reg 24))]
  4589.   ""
  4590.   "@
  4591.    cmp\\t%4, %5\;mov%d6\\t%0, %2%S7
  4592.    cmn\\t%4, #%n5\;mov%d6\\t%0, %2%S7
  4593.    cmp\\t%4, %5\;mov%D6\\t%0, %1\;mov%d6\\t%0, %2%S7
  4594.    cmn\\t%4, #%n5\;mov%D6\\t%0, %1\;mov%d6\\t%0, %2%S7"
  4595. [(set_attr "conds" "clob")
  4596.  (set_attr "length" "8,8,12,12")])
  4597.  
  4598. (define_insn ""
  4599.   [(set (match_operand:SI 0 "s_register_operand" "=r,r,r,r")
  4600.     (if_then_else:SI
  4601.      (match_operator 6 "comparison_operator"
  4602.       [(match_operand:SI 4 "s_register_operand" "r,r,r,r")
  4603.        (match_operand:SI 5 "arm_add_operand" "rI,L,rI,L")])
  4604.      (match_operand:SI 1 "arm_rhs_operand" "0,0,?rI,?rI")
  4605.      (match_operator:SI 7 "shift_operator"
  4606.       [(match_operand:SI 2 "s_register_operand" "r,r,r,r")
  4607.        (match_operand:SI 3 "arm_rhs_operand" "rM,rM,rM,rM")])))
  4608.    (clobber (reg 24))]
  4609.   ""
  4610.   "@
  4611.    cmp\\t%4, %5\;mov%D6\\t%0, %2%S7
  4612.    cmn\\t%4, #%n5\;mov%D6\\t%0, %2%S7
  4613.    cmp\\t%4, %5\;mov%d6\\t%0, %1\;mov%D6\\t%0, %2%S7
  4614.    cmn\\t%4, #%n5\;mov%d6\\t%0, %1\;mov%D6\\t%0, %2%S7"
  4615. [(set_attr "conds" "clob")
  4616.  (set_attr "length" "8,8,12,12")])
  4617.  
  4618. (define_insn ""
  4619.   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
  4620.     (if_then_else:SI
  4621.      (match_operator 7 "comparison_operator"
  4622.       [(match_operand:SI 5 "s_register_operand" "r,r")
  4623.        (match_operand:SI 6 "arm_add_operand" "rI,L")])
  4624.      (match_operator:SI 8 "shift_operator"
  4625.       [(match_operand:SI 1 "s_register_operand" "r,r")
  4626.        (match_operand:SI 2 "arm_rhs_operand" "rM,rM")])
  4627.      (match_operator:SI 9 "shift_operator"
  4628.       [(match_operand:SI 3 "s_register_operand" "r,r")
  4629.        (match_operand:SI 4 "arm_rhs_operand" "rI,rI")])))
  4630.    (clobber (reg 24))]
  4631.   ""
  4632.   "@
  4633.    cmp\\t%5, %6\;mov%d7\\t%0, %1%S8\;mov%D7\\t%0, %3%S9
  4634.    cmn\\t%5, #%n6\;mov%d7\\t%0, %1%S8\;mov%D7\\t%0, %3%S9"
  4635. [(set_attr "conds" "clob")
  4636.  (set_attr "length" "12")])
  4637.  
  4638. (define_insn ""
  4639.   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
  4640.     (if_then_else:SI
  4641.      (match_operator 6 "comparison_operator"
  4642.       [(match_operand:SI 4 "s_register_operand" "r,r")
  4643.        (match_operand:SI 5 "arm_add_operand" "rI,L")])
  4644.      (not:SI (match_operand:SI 1 "s_register_operand" "r,r"))
  4645.      (match_operator:SI 7 "shiftable_operator"
  4646.       [(match_operand:SI 2 "s_register_operand" "r,r")
  4647.        (match_operand:SI 3 "arm_rhs_operand" "rI,rI")])))
  4648.    (clobber (reg 24))]
  4649.   ""
  4650.   "@
  4651.    cmp\\t%4, %5\;mvn%d6\\t%0, %1\;%I7%D6\\t%0, %2, %3
  4652.    cmn\\t%4, #%n5\;mvn%d6\\t%0, %1\;%I7%D6\\t%0, %2, %3"
  4653. [(set_attr "conds" "clob")
  4654.  (set_attr "length" "12")])
  4655.  
  4656. (define_insn ""
  4657.   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
  4658.     (if_then_else:SI
  4659.      (match_operator 6 "comparison_operator"
  4660.       [(match_operand:SI 4 "s_register_operand" "r,r")
  4661.        (match_operand:SI 5 "arm_add_operand" "rI,L")])
  4662.      (match_operator:SI 7 "shiftable_operator"
  4663.       [(match_operand:SI 2 "s_register_operand" "r,r")
  4664.        (match_operand:SI 3 "arm_rhs_operand" "rI,rI")])
  4665.      (not:SI (match_operand:SI 1 "s_register_operand" "r,r"))))
  4666.    (clobber (reg 24))]
  4667.   ""
  4668.   "@
  4669.    cmp\\t%4, %5\;mvn%D6\\t%0, %1\;%I7%d6\\t%0, %2, %3
  4670.    cmn\\t%4, #%n5\;mvn%D6\\t%0, %1\;%I7%d6\\t%0, %2, %3"
  4671. [(set_attr "conds" "clob")
  4672.  (set_attr "length" "12")])
  4673.  
  4674. (define_insn ""
  4675.   [(set (match_operand:SI 0 "s_register_operand" "=r,r,r,r")
  4676.     (if_then_else:SI
  4677.      (match_operator 5 "comparison_operator"
  4678.       [(match_operand:SI 3 "s_register_operand" "r,r,r,r")
  4679.        (match_operand:SI 4 "arm_add_operand" "rI,L,rI,L")])
  4680.      (neg:SI (match_operand:SI 2 "s_register_operand" "r,r,r,r"))
  4681.      (match_operand:SI 1 "arm_rhs_operand" "0,0,?rI,?rI")))
  4682.    (clobber (reg:CC 24))]
  4683.   ""
  4684.   "@
  4685.    cmp\\t%3, %4\;rsb%d5\\t%0, %2, #0
  4686.    cmn\\t%3, #%n4\;rsb%d5\\t%0, %2, #0
  4687.    cmp\\t%3, %4\;mov%D5\\t%0, %1\;rsb%d5\\t%0, %2, #0
  4688.    cmn\\t%3, #%n4\;mov%D5\\t%0, %1\;rsb%d5\\t%0, %2, #0"
  4689. [(set_attr "conds" "clob")
  4690.  (set_attr "length" "8,8,12,12")])
  4691.  
  4692. (define_insn ""
  4693.   [(set (match_operand:SI 0 "s_register_operand" "=r,r,r,r")
  4694.     (if_then_else:SI
  4695.      (match_operator 5 "comparison_operator"
  4696.       [(match_operand:SI 3 "s_register_operand" "r,r,r,r")
  4697.        (match_operand:SI 4 "arm_add_operand" "rI,L,rI,L")])
  4698.      (match_operand:SI 1 "arm_rhs_operand" "0,0,?rI,?rI")
  4699.      (neg:SI (match_operand:SI 2 "s_register_operand" "r,r,r,r"))))
  4700.    (clobber (reg:CC 24))]
  4701.   ""
  4702.   "@
  4703.    cmp\\t%3, %4\;rsb%D5\\t%0, %2, #0
  4704.    cmn\\t%3, #%n4\;rsb%D5\\t%0, %2, #0
  4705.    cmp\\t%3, %4\;mov%d5\\t%0, %1\;rsb%D5\\t%0, %2, #0
  4706.    cmn\\t%3, #%n4\;mov%d5\\t%0, %1\;rsb%D5\\t%0, %2, #0"
  4707. [(set_attr "conds" "clob")
  4708.  (set_attr "length" "8,8,12,12")])
  4709.  
  4710. (define_insn ""
  4711.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  4712.     (match_operator:SI 1 "shiftable_operator"
  4713.      [(match_operand:SI 2 "memory_operand" "m")
  4714.       (match_operand:SI 3 "memory_operand" "m")]))
  4715.    (clobber (match_scratch:SI 4 "=r"))]
  4716.   "adjacent_mem_locations (operands[2], operands[3])"
  4717.   "*
  4718. {
  4719.   rtx ldm[3];
  4720.   rtx arith[4];
  4721.   int val1 = 0, val2 = 0;
  4722.  
  4723.   if (REGNO (operands[0]) > REGNO (operands[4]))
  4724.     {
  4725.       ldm[1] = operands[4];
  4726.       ldm[2] = operands[0];
  4727.     }
  4728.   else
  4729.     {
  4730.       ldm[1] = operands[0];
  4731.       ldm[2] = operands[4];
  4732.     }
  4733.   if (GET_CODE (XEXP (operands[2], 0)) != REG)
  4734.     val1 = INTVAL (XEXP (XEXP (operands[2], 0), 1));
  4735.   if (GET_CODE (XEXP (operands[3], 0)) != REG)
  4736.     val2 = INTVAL (XEXP (XEXP (operands[3], 0), 1));
  4737.   arith[0] = operands[0];
  4738.   arith[3] = operands[1];
  4739.   if (val1 < val2)
  4740.     {
  4741.       arith[1] = ldm[1];
  4742.       arith[2] = ldm[2];
  4743.     }
  4744.   else
  4745.     {
  4746.       arith[1] = ldm[2];
  4747.       arith[2] = ldm[1];
  4748.     }
  4749.   if (val1 && val2)
  4750.     {
  4751.       rtx ops[3];
  4752.       ldm[0] = ops[0] = operands[4];
  4753.       ops[1] = XEXP (XEXP (operands[2], 0), 0);
  4754.       ops[2] = XEXP (XEXP (operands[2], 0), 1);
  4755.       output_add_immediate (ops);
  4756.       if (val1 < val2)
  4757.     output_asm_insn (\"ldm%?ia\\t%0, {%1, %2}\", ldm);
  4758.       else
  4759.     output_asm_insn (\"ldm%?da\\t%0, {%1, %2}\", ldm);
  4760.     }
  4761.   else if (val1)
  4762.     {
  4763.       ldm[0] = XEXP (operands[3], 0);
  4764.       if (val1 < val2)
  4765.     output_asm_insn (\"ldm%?da\\t%0, {%1, %2}\", ldm);
  4766.       else
  4767.     output_asm_insn (\"ldm%?ia\\t%0, {%1, %2}\", ldm);
  4768.     }
  4769.   else
  4770.     {
  4771.       ldm[0] = XEXP (operands[2], 0);
  4772.       if (val1 < val2)
  4773.     output_asm_insn (\"ldm%?ia\\t%0, {%1, %2}\", ldm);
  4774.       else
  4775.     output_asm_insn (\"ldm%?da\\t%0, {%1, %2}\", ldm);
  4776.     }
  4777.   output_asm_insn (\"%I3%?\\t%0, %1, %2\", arith);
  4778.   return \"\";
  4779. }
  4780. "
  4781. [(set_attr "length" "12")
  4782.  (set_attr "type" "load")])
  4783.  
  4784. ;; the arm can support extended pre-inc instructions
  4785.  
  4786. ;; In all these cases, we use operands 0 and 1 for the register being
  4787. ;; incremented because those are the operands that local-alloc will
  4788. ;; tie and these are the pair most likely to be tieable (and the ones
  4789. ;; that will benefit the most).
  4790.  
  4791. ;; We reject the frame pointer if it occurs anywhere in these patterns since
  4792. ;; elimination will cause too many headaches.
  4793.  
  4794. (define_insn ""
  4795.   [(set (mem:QI (plus:SI (match_operand:SI 1 "s_register_operand" "%0")
  4796.              (match_operand:SI 2 "index_operand" "rJ")))
  4797.     (match_operand:QI 3 "s_register_operand" "r"))
  4798.    (set (match_operand:SI 0 "s_register_operand" "=r")
  4799.     (plus:SI (match_dup 1) (match_dup 2)))]
  4800.   "REGNO (operands[0]) != FRAME_POINTER_REGNUM
  4801.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  4802.    && (GET_CODE (operands[2]) != REG
  4803.        || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
  4804.   "str%?b\\t%3, [%0, %2]!"
  4805. [(set_attr "type" "store1")])
  4806.  
  4807. (define_insn ""
  4808.   [(set (mem:QI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
  4809.               (match_operand:SI 2 "s_register_operand" "r")))
  4810.     (match_operand:QI 3 "s_register_operand" "r"))
  4811.    (set (match_operand:SI 0 "s_register_operand" "=r")
  4812.     (minus:SI (match_dup 1) (match_dup 2)))]
  4813.   "REGNO (operands[0]) != FRAME_POINTER_REGNUM
  4814.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  4815.    && (GET_CODE (operands[2]) != REG
  4816.        || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
  4817.   "str%?b\\t%3, [%0, -%2]!"
  4818. [(set_attr "type" "store1")])
  4819.  
  4820. (define_insn ""
  4821.   [(set (match_operand:QI 3 "s_register_operand" "=r")
  4822.     (mem:QI (plus:SI (match_operand:SI 1 "s_register_operand" "%0")
  4823.              (match_operand:SI 2 "index_operand" "rJ"))))
  4824.    (set (match_operand:SI 0 "s_register_operand" "=r")
  4825.     (plus:SI (match_dup 1) (match_dup 2)))]
  4826.   "REGNO (operands[0]) != FRAME_POINTER_REGNUM
  4827.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  4828.    && (GET_CODE (operands[2]) != REG
  4829.        || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
  4830.   "ldr%?b\\t%3, [%0, %2]!"
  4831. [(set_attr "type" "load")])
  4832.  
  4833. (define_insn ""
  4834.   [(set (match_operand:QI 3 "s_register_operand" "=r")
  4835.     (mem:QI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
  4836.               (match_operand:SI 2 "s_register_operand" "r"))))
  4837.    (set (match_operand:SI 0 "s_register_operand" "=r")
  4838.     (minus:SI (match_dup 1) (match_dup 2)))]
  4839.   "REGNO (operands[0]) != FRAME_POINTER_REGNUM
  4840.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  4841.    && (GET_CODE (operands[2]) != REG
  4842.        || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
  4843.   "ldr%?b\\t%3, [%0, -%2]!"
  4844. [(set_attr "type" "load")])
  4845.  
  4846. (define_insn ""
  4847.   [(set (match_operand:SI 3 "s_register_operand" "=r")
  4848.     (zero_extend:SI
  4849.      (mem:QI (plus:SI (match_operand:SI 1 "s_register_operand" "%0")
  4850.               (match_operand:SI 2 "index_operand" "rJ")))))
  4851.    (set (match_operand:SI 0 "s_register_operand" "=r")
  4852.     (plus:SI (match_dup 1) (match_dup 2)))]
  4853.   "REGNO (operands[0]) != FRAME_POINTER_REGNUM
  4854.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  4855.    && (GET_CODE (operands[2]) != REG
  4856.        || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
  4857.   "ldr%?b\\t%3, [%0, %2]!\\t%@ z_extendqisi"
  4858. [(set_attr "type" "load")])
  4859.  
  4860. (define_insn ""
  4861.   [(set (match_operand:SI 3 "s_register_operand" "=r")
  4862.     (zero_extend:SI
  4863.      (mem:QI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
  4864.                (match_operand:SI 2 "s_register_operand" "r")))))
  4865.    (set (match_operand:SI 0 "s_register_operand" "=r")
  4866.     (minus:SI (match_dup 1) (match_dup 2)))]
  4867.   "REGNO (operands[0]) != FRAME_POINTER_REGNUM
  4868.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  4869.    && (GET_CODE (operands[2]) != REG
  4870.        || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
  4871.   "ldr%?b\\t%3, [%0, -%2]!\\t%@ z_extendqisi"
  4872. [(set_attr "type" "load")])
  4873.  
  4874. (define_insn ""
  4875.   [(set (mem:SI (plus:SI (match_operand:SI 1 "s_register_operand" "%0")
  4876.              (match_operand:SI 2 "index_operand" "rJ")))
  4877.     (match_operand:SI 3 "s_register_operand" "r"))
  4878.    (set (match_operand:SI 0 "s_register_operand" "=r")
  4879.     (plus:SI (match_dup 1) (match_dup 2)))]
  4880.   "REGNO (operands[0]) != FRAME_POINTER_REGNUM
  4881.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  4882.    && (GET_CODE (operands[2]) != REG
  4883.        || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
  4884.   "str%?\\t%3, [%0, %2]!"
  4885. [(set_attr "type" "store1")])
  4886.  
  4887. (define_insn ""
  4888.   [(set (mem:SI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
  4889.               (match_operand:SI 2 "s_register_operand" "r")))
  4890.     (match_operand:SI 3 "s_register_operand" "r"))
  4891.    (set (match_operand:SI 0 "s_register_operand" "=r")
  4892.     (minus:SI (match_dup 1) (match_dup 2)))]
  4893.   "REGNO (operands[0]) != FRAME_POINTER_REGNUM
  4894.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  4895.    && (GET_CODE (operands[2]) != REG
  4896.        || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
  4897.   "str%?\\t%3, [%0, -%2]!"
  4898. [(set_attr "type" "store1")])
  4899.  
  4900. (define_insn ""
  4901.   [(set (match_operand:SI 3 "s_register_operand" "=r")
  4902.     (mem:SI (plus:SI (match_operand:SI 1 "s_register_operand" "%0")
  4903.              (match_operand:SI 2 "index_operand" "rJ"))))
  4904.    (set (match_operand:SI 0 "s_register_operand" "=r")
  4905.     (plus:SI (match_dup 1) (match_dup 2)))]
  4906.   "REGNO (operands[0]) != FRAME_POINTER_REGNUM
  4907.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  4908.    && (GET_CODE (operands[2]) != REG
  4909.        || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
  4910.   "ldr%?\\t%3, [%0, %2]!"
  4911. [(set_attr "type" "load")])
  4912.  
  4913. (define_insn ""
  4914.   [(set (match_operand:SI 3 "s_register_operand" "=r")
  4915.     (mem:SI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
  4916.               (match_operand:SI 2 "s_register_operand" "r"))))
  4917.    (set (match_operand:SI 0 "s_register_operand" "=r")
  4918.     (minus:SI (match_dup 1) (match_dup 2)))]
  4919.   "REGNO (operands[0]) != FRAME_POINTER_REGNUM
  4920.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  4921.    && (GET_CODE (operands[2]) != REG
  4922.        || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
  4923.   "ldr%?\\t%3, [%0, -%2]!"
  4924. [(set_attr "type" "load")])
  4925.  
  4926. (define_insn ""
  4927.   [(set (match_operand:HI 3 "s_register_operand" "=r")
  4928.     (mem:HI (plus:SI (match_operand:SI 1 "s_register_operand" "%0")
  4929.              (match_operand:SI 2 "index_operand" "rJ"))))
  4930.    (set (match_operand:SI 0 "s_register_operand" "=r")
  4931.     (plus:SI (match_dup 1) (match_dup 2)))]
  4932.   "(! BYTES_BIG_ENDIAN)
  4933.    && ! TARGET_SHORT_BY_BYTES
  4934.    && REGNO (operands[0]) != FRAME_POINTER_REGNUM
  4935.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  4936.    && (GET_CODE (operands[2]) != REG
  4937.        || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
  4938.   "ldr%?\\t%3, [%0, %2]!\\t%@ loadhi"
  4939. [(set_attr "type" "load")])
  4940.  
  4941. (define_insn ""
  4942.   [(set (match_operand:HI 3 "s_register_operand" "=r")
  4943.     (mem:HI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
  4944.               (match_operand:SI 2 "s_register_operand" "r"))))
  4945.    (set (match_operand:SI 0 "s_register_operand" "=r")
  4946.     (minus:SI (match_dup 1) (match_dup 2)))]
  4947.   "(!BYTES_BIG_ENDIAN)
  4948.    && ! TARGET_SHORT_BY_BYTES
  4949.    && REGNO (operands[0]) != FRAME_POINTER_REGNUM
  4950.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  4951.    && (GET_CODE (operands[2]) != REG
  4952.        || REGNO (operands[2]) != FRAME_POINTER_REGNUM)"
  4953.   "ldr%?\\t%3, [%0, -%2]!\\t%@ loadhi"
  4954. [(set_attr "type" "load")])
  4955.  
  4956. (define_insn ""
  4957.   [(set (mem:QI (plus:SI (match_operator:SI 2 "shift_operator"
  4958.               [(match_operand:SI 3 "s_register_operand" "r")
  4959.                (match_operand:SI 4 "const_shift_operand" "n")])
  4960.              (match_operand:SI 1 "s_register_operand" "0")))
  4961.     (match_operand:QI 5 "s_register_operand" "r"))
  4962.    (set (match_operand:SI 0 "s_register_operand" "=r")
  4963.     (plus:SI (match_op_dup 2 [(match_dup 3)    (match_dup 4)])
  4964.          (match_dup 1)))]
  4965.   "REGNO (operands[0]) != FRAME_POINTER_REGNUM
  4966.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  4967.    && REGNO (operands[3]) != FRAME_POINTER_REGNUM"
  4968.   "str%?b\\t%5, [%0, %3%S2]!"
  4969. [(set_attr "type" "store1")])
  4970.  
  4971. (define_insn ""
  4972.   [(set (mem:QI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
  4973.               (match_operator:SI 2 "shift_operator"
  4974.                [(match_operand:SI 3 "s_register_operand" "r")
  4975.                 (match_operand:SI 4 "const_shift_operand" "n")])))
  4976.     (match_operand:QI 5 "s_register_operand" "r"))
  4977.    (set (match_operand:SI 0 "s_register_operand" "=r")
  4978.     (minus:SI (match_dup 1) (match_op_dup 2 [(match_dup 3)
  4979.                          (match_dup 4)])))]
  4980.   "REGNO (operands[0]) != FRAME_POINTER_REGNUM
  4981.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  4982.    && REGNO (operands[3]) != FRAME_POINTER_REGNUM"
  4983.   "str%?b\\t%5, [%0, -%3%S2]!"
  4984. [(set_attr "type" "store1")])
  4985.  
  4986. (define_insn ""
  4987.   [(set (match_operand:QI 5 "s_register_operand" "=r")
  4988.     (mem:QI (plus:SI (match_operator:SI 2 "shift_operator"
  4989.               [(match_operand:SI 3 "s_register_operand" "r")
  4990.                (match_operand:SI 4 "const_shift_operand" "n")])
  4991.              (match_operand:SI 1 "s_register_operand" "0"))))
  4992.    (set (match_operand:SI 0 "s_register_operand" "=r")
  4993.     (plus:SI (match_op_dup 2 [(match_dup 3)    (match_dup 4)])
  4994.          (match_dup 1)))]
  4995.   "REGNO (operands[0]) != FRAME_POINTER_REGNUM
  4996.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  4997.    && REGNO (operands[3]) != FRAME_POINTER_REGNUM"
  4998.   "ldr%?b\\t%5, [%0, %3%S2]!"
  4999. [(set_attr "type" "load")])
  5000.  
  5001. (define_insn ""
  5002.   [(set (match_operand:QI 5 "s_register_operand" "=r")
  5003.     (mem:QI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
  5004.               (match_operator:SI 2 "shift_operator"
  5005.                [(match_operand:SI 3 "s_register_operand" "r")
  5006.                 (match_operand:SI 4 "const_shift_operand" "n")]))))
  5007.    (set (match_operand:SI 0 "s_register_operand" "=r")
  5008.     (minus:SI (match_dup 1) (match_op_dup 2 [(match_dup 3)
  5009.                          (match_dup 4)])))]
  5010.   "REGNO (operands[0]) != FRAME_POINTER_REGNUM
  5011.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  5012.    && REGNO (operands[3]) != FRAME_POINTER_REGNUM"
  5013.   "ldr%?b\\t%5, [%0, -%3%S2]!"
  5014. [(set_attr "type" "load")])
  5015.  
  5016. (define_insn ""
  5017.   [(set (mem:SI (plus:SI (match_operator:SI 2 "shift_operator"
  5018.               [(match_operand:SI 3 "s_register_operand" "r")
  5019.                (match_operand:SI 4 "const_shift_operand" "n")])
  5020.              (match_operand:SI 1 "s_register_operand" "0")))
  5021.     (match_operand:SI 5 "s_register_operand" "r"))
  5022.    (set (match_operand:SI 0 "s_register_operand" "=r")
  5023.     (plus:SI (match_op_dup 2 [(match_dup 3)    (match_dup 4)])
  5024.          (match_dup 1)))]
  5025.   "REGNO (operands[0]) != FRAME_POINTER_REGNUM
  5026.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  5027.    && REGNO (operands[3]) != FRAME_POINTER_REGNUM"
  5028.   "str%?\\t%5, [%0, %3%S2]!"
  5029. [(set_attr "type" "store1")])
  5030.  
  5031. (define_insn ""
  5032.   [(set (mem:SI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
  5033.               (match_operator:SI 2 "shift_operator"
  5034.                [(match_operand:SI 3 "s_register_operand" "r")
  5035.                 (match_operand:SI 4 "const_shift_operand" "n")])))
  5036.     (match_operand:SI 5 "s_register_operand" "r"))
  5037.    (set (match_operand:SI 0 "s_register_operand" "=r")
  5038.     (minus:SI (match_dup 1) (match_op_dup 2 [(match_dup 3)
  5039.                          (match_dup 4)])))]
  5040.   "REGNO (operands[0]) != FRAME_POINTER_REGNUM
  5041.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  5042.    && REGNO (operands[3]) != FRAME_POINTER_REGNUM"
  5043.   "str%?\\t%5, [%0, -%3%S2]!"
  5044. [(set_attr "type" "store1")])
  5045.  
  5046. (define_insn ""
  5047.   [(set (match_operand:SI 5 "s_register_operand" "=r")
  5048.     (mem:SI (plus:SI (match_operator:SI 2 "shift_operator"
  5049.               [(match_operand:SI 3 "s_register_operand" "r")
  5050.                (match_operand:SI 4 "const_shift_operand" "n")])
  5051.              (match_operand:SI 1 "s_register_operand" "0"))))
  5052.    (set (match_operand:SI 0 "s_register_operand" "=r")
  5053.     (plus:SI (match_op_dup 2 [(match_dup 3) (match_dup 4)])
  5054.          (match_dup 1)))]
  5055.   "REGNO (operands[0]) != FRAME_POINTER_REGNUM
  5056.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  5057.    && REGNO (operands[3]) != FRAME_POINTER_REGNUM"
  5058.   "ldr%?\\t%5, [%0, %3%S2]!"
  5059. [(set_attr "type" "load")])
  5060.  
  5061. (define_insn ""
  5062.   [(set (match_operand:SI 5 "s_register_operand" "=r")
  5063.     (mem:SI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
  5064.               (match_operator:SI 2 "shift_operator"
  5065.                [(match_operand:SI 3 "s_register_operand" "r")
  5066.                 (match_operand:SI 4 "const_shift_operand" "n")]))))
  5067.    (set (match_operand:SI 0 "s_register_operand" "=r")
  5068.     (minus:SI (match_dup 1) (match_op_dup 2 [(match_dup 3)
  5069.                          (match_dup 4)])))]
  5070.   "REGNO (operands[0]) != FRAME_POINTER_REGNUM
  5071.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  5072.    && REGNO (operands[3]) != FRAME_POINTER_REGNUM"
  5073.   "ldr%?\\t%5, [%0, -%3%S2]!"
  5074. [(set_attr "type" "load")])
  5075.  
  5076. (define_insn ""
  5077.   [(set (match_operand:HI 5 "s_register_operand" "=r")
  5078.     (mem:HI (plus:SI (match_operator:SI 2 "shift_operator"
  5079.               [(match_operand:SI 3 "s_register_operand" "r")
  5080.                (match_operand:SI 4 "const_shift_operand" "n")])
  5081.              (match_operand:SI 1 "s_register_operand" "0"))))
  5082.    (set (match_operand:SI 0 "s_register_operand" "=r")
  5083.     (plus:SI (match_op_dup 2 [(match_dup 3)    (match_dup 4)])
  5084.          (match_dup 1)))]
  5085.   "(! BYTES_BIG_ENDIAN)
  5086.    && ! TARGET_SHORT_BY_BYTES
  5087.    && REGNO (operands[0]) != FRAME_POINTER_REGNUM
  5088.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  5089.    && REGNO (operands[3]) != FRAME_POINTER_REGNUM"
  5090.   "ldr%?\\t%5, [%0, %3%S2]!\\t%@ loadhi"
  5091. [(set_attr "type" "load")])
  5092.  
  5093. (define_insn ""
  5094.   [(set (match_operand:HI 5 "s_register_operand" "=r")
  5095.     (mem:HI (minus:SI (match_operand:SI 1 "s_register_operand" "0")
  5096.               (match_operator:SI 2 "shift_operator"
  5097.                [(match_operand:SI 3 "s_register_operand" "r")
  5098.                 (match_operand:SI 4 "const_shift_operand" "n")]))))
  5099.    (set (match_operand:SI 0 "s_register_operand" "=r")
  5100.     (minus:SI (match_dup 1) (match_op_dup 2 [(match_dup 3)
  5101.                          (match_dup 4)])))]
  5102.   "(! BYTES_BIG_ENDIAN)
  5103.    && ! TARGET_SHORT_BY_BYTES
  5104.    && REGNO (operands[0]) != FRAME_POINTER_REGNUM
  5105.    && REGNO (operands[1]) != FRAME_POINTER_REGNUM
  5106.    && REGNO (operands[3]) != FRAME_POINTER_REGNUM"
  5107.   "ldr%?\\t%5, [%0, -%3%S2]!\\t%@ loadhi"
  5108. [(set_attr "type" "load")])
  5109.  
  5110. ; It can also support extended post-inc expressions, but combine doesn't
  5111. ; try these....
  5112. ; It doesn't seem worth adding peepholes for anything but the most common
  5113. ; cases since, unlike combine, the increment must immediately follow the load
  5114. ; for this pattern to match.
  5115. ; When loading we must watch to see that the base register isn't trampled by
  5116. ; the load.  In such cases this isn't a post-inc expression.
  5117.  
  5118. (define_peephole
  5119.   [(set (mem:QI (match_operand:SI 0 "s_register_operand" "+r"))
  5120.     (match_operand:QI 2 "s_register_operand" "r"))
  5121.    (set (match_dup 0)
  5122.     (plus:SI (match_dup 0) (match_operand:SI 1 "index_operand" "rJ")))]
  5123.   ""
  5124.   "str%?b\\t%2, [%0], %1")
  5125.  
  5126. (define_peephole
  5127.   [(set (match_operand:QI 0 "s_register_operand" "=r")
  5128.     (mem:QI (match_operand:SI 1 "s_register_operand" "+r")))
  5129.    (set (match_dup 1)
  5130.     (plus:SI (match_dup 1) (match_operand:SI 2 "index_operand" "rJ")))]
  5131.   "REGNO(operands[0]) != REGNO(operands[1])
  5132.    && (GET_CODE (operands[2]) != REG
  5133.        || REGNO(operands[0]) != REGNO (operands[2]))"
  5134.   "ldr%?b\\t%0, [%1], %2")
  5135.  
  5136. (define_peephole
  5137.   [(set (mem:SI (match_operand:SI 0 "s_register_operand" "+r"))
  5138.     (match_operand:SI 2 "s_register_operand" "r"))
  5139.    (set (match_dup 0)
  5140.     (plus:SI (match_dup 0) (match_operand:SI 1 "index_operand" "rJ")))]
  5141.   ""
  5142.   "str%?\\t%2, [%0], %1")
  5143.  
  5144. (define_peephole
  5145.   [(set (match_operand:HI 0 "s_register_operand" "=r")
  5146.     (mem:HI (match_operand:SI 1 "s_register_operand" "+r")))
  5147.    (set (match_dup 1)
  5148.     (plus:SI (match_dup 1) (match_operand:SI 2 "index_operand" "rJ")))]
  5149.   "(! BYTES_BIG_ENDIAN)
  5150.    && ! TARGET_SHORT_BY_BYTES
  5151.    && REGNO(operands[0]) != REGNO(operands[1])
  5152.    && (GET_CODE (operands[2]) != REG
  5153.        || REGNO(operands[0]) != REGNO (operands[2]))"
  5154.   "ldr%?\\t%0, [%1], %2\\t%@ loadhi")
  5155.  
  5156. (define_peephole
  5157.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  5158.     (mem:SI (match_operand:SI 1 "s_register_operand" "+r")))
  5159.    (set (match_dup 1)
  5160.     (plus:SI (match_dup 1) (match_operand:SI 2 "index_operand" "rJ")))]
  5161.   "REGNO(operands[0]) != REGNO(operands[1])
  5162.    && (GET_CODE (operands[2]) != REG
  5163.        || REGNO(operands[0]) != REGNO (operands[2]))"
  5164.   "ldr%?\\t%0, [%1], %2")
  5165.  
  5166. (define_peephole
  5167.   [(set (mem:QI (plus:SI (match_operand:SI 0 "s_register_operand" "+r")
  5168.              (match_operand:SI 1 "index_operand" "rJ")))
  5169.     (match_operand:QI 2 "s_register_operand" "r"))
  5170.    (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))]
  5171.   ""
  5172.   "str%?b\\t%2, [%0, %1]!")
  5173.  
  5174. (define_peephole
  5175.   [(set (mem:QI (plus:SI (match_operator:SI 4 "shift_operator"
  5176.               [(match_operand:SI 0 "s_register_operand" "r")
  5177.                (match_operand:SI 1 "const_int_operand" "n")])
  5178.              (match_operand:SI 2 "s_register_operand" "+r")))
  5179.     (match_operand:QI 3 "s_register_operand" "r"))
  5180.    (set (match_dup 2) (plus:SI (match_op_dup 4 [(match_dup 0) (match_dup 1)])
  5181.                    (match_dup 2)))]
  5182.   ""
  5183.   "str%?b\\t%3, [%2, %0%S4]!")
  5184.  
  5185. ; This pattern is never tried by combine, so do it as a peephole
  5186.  
  5187. (define_peephole
  5188.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  5189.     (match_operand:SI 1 "s_register_operand" "r"))
  5190.    (set (match_operand 2 "cc_register" "")
  5191.     (compare (match_dup 1) (const_int 0)))]
  5192.   ""
  5193.   "sub%?s\\t%0, %1, #0"
  5194. [(set_attr "conds" "set")])
  5195.  
  5196. ; Peepholes to spot possible load- and store-multiples, if the ordering is
  5197. ; reversed, check that the memory references aren't volatile.
  5198.  
  5199. (define_peephole
  5200.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  5201.         (mem:SI (plus:SI (match_operand:SI 1 "s_register_operand" "r")
  5202.                          (const_int 12))))
  5203.    (set (match_operand:SI 2 "s_register_operand" "=r")
  5204.         (mem:SI (plus:SI (match_dup 1) (const_int 8))))
  5205.    (set (match_operand:SI 3 "s_register_operand" "=r")
  5206.         (mem:SI (plus:SI (match_dup 1) (const_int 4))))
  5207.    (set (match_operand:SI 4 "s_register_operand" "=r")
  5208.         (mem:SI (match_dup 1)))]
  5209.   "REGNO (operands[0]) > REGNO (operands[2])
  5210.    && REGNO (operands[2]) > REGNO (operands[3])
  5211.    && REGNO (operands[3]) > REGNO (operands[4])
  5212.    && !(REGNO (operands[1]) == REGNO (operands[0])
  5213.        || REGNO (operands[1]) == REGNO (operands[2])
  5214.        || REGNO (operands[1]) == REGNO (operands[3])
  5215.        || REGNO (operands[1]) == REGNO (operands[4]))
  5216.    && !MEM_VOLATILE_P (SET_SRC (PATTERN (insn)))
  5217.    && !MEM_VOLATILE_P (SET_SRC (PATTERN (prev_nonnote_insn (insn))))
  5218.    && !MEM_VOLATILE_P (SET_SRC (PATTERN (prev_nonnote_insn
  5219.                      (prev_nonnote_insn (insn)))))
  5220.    && !MEM_VOLATILE_P (SET_SRC (PATTERN (prev_nonnote_insn
  5221.                      (prev_nonnote_insn 
  5222.                       (prev_nonnote_insn (insn))))))"
  5223.   "ldm%?ia\\t%1, {%4, %3, %2, %0}\\t%@ phole ldm")
  5224.  
  5225. (define_peephole
  5226.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  5227.         (mem:SI (plus:SI (match_operand:SI 1 "s_register_operand" "r")
  5228.                          (const_int 8))))
  5229.    (set (match_operand:SI 2 "s_register_operand" "=r")
  5230.         (mem:SI (plus:SI (match_dup 1) (const_int 4))))
  5231.    (set (match_operand:SI 3 "s_register_operand" "=r")
  5232.         (mem:SI (match_dup 1)))]
  5233.   "REGNO (operands[0]) >  REGNO (operands[2])
  5234.    && REGNO (operands[2]) > REGNO (operands[3])
  5235.    && !(REGNO (operands[1]) == REGNO (operands[0])
  5236.        || REGNO (operands[1]) == REGNO (operands[2])
  5237.        || REGNO (operands[1]) == REGNO (operands[3]))
  5238.    && !MEM_VOLATILE_P (SET_SRC (PATTERN (insn)))
  5239.    && !MEM_VOLATILE_P (SET_SRC (PATTERN (prev_nonnote_insn (insn))))
  5240.    && !MEM_VOLATILE_P (SET_SRC (PATTERN (prev_nonnote_insn
  5241.                      (prev_nonnote_insn (insn)))))"
  5242.   "ldm%?ia\\t%1, {%3, %2, %0}\\t%@ phole ldm")
  5243.  
  5244. (define_peephole
  5245.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  5246.         (mem:SI (plus:SI (match_operand:SI 1 "s_register_operand" "r")
  5247.                          (const_int 4))))
  5248.    (set (match_operand:SI 2 "s_register_operand" "=r")
  5249.         (mem:SI (match_dup 1)))]
  5250.   "REGNO (operands[0]) > REGNO (operands[2])
  5251.    && !(REGNO (operands[1]) == REGNO (operands[0])
  5252.        || REGNO (operands[1]) == REGNO (operands[2]))
  5253.    && !MEM_VOLATILE_P (SET_SRC (PATTERN (insn)))
  5254.    && !MEM_VOLATILE_P (SET_SRC (PATTERN (prev_nonnote_insn (insn))))"
  5255.   "ldm%?ia\\t%1, {%2, %0}\\t%@ phole ldm")
  5256.  
  5257. (define_peephole
  5258.   [(set (mem:SI (plus:SI (match_operand:SI 1 "s_register_operand" "r")
  5259.                          (const_int 12)))
  5260.         (match_operand:SI 0 "s_register_operand" "r"))
  5261.    (set (mem:SI (plus:SI (match_dup 1) (const_int 8)))
  5262.         (match_operand:SI 2 "s_register_operand" "r"))
  5263.    (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
  5264.         (match_operand:SI 3 "s_register_operand" "r"))
  5265.    (set (mem:SI (match_dup 1))
  5266.         (match_operand:SI 4 "s_register_operand" "r"))]
  5267.   "REGNO (operands[0]) >  REGNO (operands[2])
  5268.    && REGNO (operands[2]) > REGNO (operands[3])
  5269.    && REGNO (operands[3]) > REGNO (operands[4])
  5270.    && !MEM_VOLATILE_P (SET_DEST (PATTERN (insn)))
  5271.    && !MEM_VOLATILE_P (SET_DEST (PATTERN (prev_nonnote_insn (insn))))
  5272.    && !MEM_VOLATILE_P (SET_DEST (PATTERN (prev_nonnote_insn
  5273.                       (prev_nonnote_insn (insn)))))
  5274.    && !MEM_VOLATILE_P (SET_DEST (PATTERN (prev_nonnote_insn
  5275.                       (prev_nonnote_insn 
  5276.                        (prev_nonnote_insn (insn))))))"
  5277.   "stm%?ia\\t%1, {%4, %3, %2, %0}\\t%@ phole stm")
  5278.  
  5279. (define_peephole
  5280.   [(set (mem:SI (plus:SI (match_operand:SI 1 "s_register_operand" "r")
  5281.                          (const_int 8)))
  5282.         (match_operand:SI 0 "s_register_operand" "r"))
  5283.    (set (mem:SI (plus:SI (match_dup 1) (const_int 4)))
  5284.         (match_operand:SI 2 "s_register_operand" "r"))
  5285.    (set (mem:SI (match_dup 1))
  5286.         (match_operand:SI 3 "s_register_operand" "r"))]
  5287.   "REGNO (operands[0]) >  REGNO (operands[2])
  5288.    && REGNO (operands[2]) > REGNO (operands[3])
  5289.    && !MEM_VOLATILE_P (SET_DEST (PATTERN (insn)))
  5290.    && !MEM_VOLATILE_P (SET_DEST (PATTERN (prev_nonnote_insn (insn))))
  5291.    && !MEM_VOLATILE_P (SET_DEST (PATTERN (prev_nonnote_insn
  5292.                       (prev_nonnote_insn (insn)))))"
  5293.   "stm%?ia\\t%1, {%3, %2, %0}\\t%@ phole stm")
  5294.  
  5295. (define_peephole
  5296.   [(set (mem:SI (plus:SI (match_operand:SI 1 "s_register_operand" "r")
  5297.                          (const_int 4)))
  5298.         (match_operand:SI 0 "s_register_operand" "r"))
  5299.    (set (mem:SI (match_dup 1))
  5300.         (match_operand:SI 2 "s_register_operand" "r"))]
  5301.   "REGNO (operands[0]) >  REGNO (operands[2])
  5302.    && !MEM_VOLATILE_P (SET_DEST (PATTERN (insn)))
  5303.    && !MEM_VOLATILE_P (SET_DEST (PATTERN (prev_nonnote_insn (insn))))"
  5304.   "stm%?ia\\t%1, {%2, %0}\\t%@ phole stm")
  5305.  
  5306. ;; A call followed by return can be replaced by restoring the regs and
  5307. ;; jumping to the subroutine, provided we aren't passing the address of
  5308. ;; any of our local variables.  If we call alloca then this is unsafe
  5309. ;; since restoring the frame frees the memory, which is not what we want.
  5310. ;; Sometimes the return might have been targeted by the final prescan:
  5311. ;; if so then emit a proper return insn as well.
  5312. ;; Unfortunately, if the frame pointer is required, we don't know if the
  5313. ;; current function has any implicit stack pointer adjustments that will 
  5314. ;; be restored by the return: we can't therefore do a tail call.
  5315. ;; Another unfortunate that we can't handle is if current_function_args_size
  5316. ;; is non-zero: in this case elimination of the argument pointer assumed
  5317. ;; that lr was pushed onto the stack, so eliminating upsets the offset
  5318. ;; calculations.
  5319.  
  5320. (define_peephole
  5321.   [(parallel [(call (mem:SI (match_operand:SI 0 "" "i"))
  5322.               (match_operand:SI 1 "general_operand" "g"))
  5323.             (clobber (reg:SI 14))])
  5324.    (return)]
  5325.   "(GET_CODE (operands[0]) == SYMBOL_REF && USE_RETURN_INSN
  5326.     && !get_frame_size () && !current_function_calls_alloca
  5327.     && !frame_pointer_needed && !current_function_args_size)"
  5328.   "*
  5329. {
  5330.   extern rtx arm_target_insn;
  5331.   extern int arm_ccfsm_state, arm_current_cc;
  5332.  
  5333.   if (arm_ccfsm_state && arm_target_insn && INSN_DELETED_P (arm_target_insn))
  5334.   {
  5335.     arm_current_cc ^= 1;
  5336.     output_return_instruction (NULL, TRUE);
  5337.     arm_ccfsm_state = 0;
  5338.     arm_target_insn = NULL;
  5339.   }
  5340.  
  5341.   output_return_instruction (NULL, FALSE);
  5342.   return \"b%?\\t%a0\";
  5343. }"
  5344. [(set (attr "conds")
  5345.       (if_then_else (eq_attr "cpu" "arm6")
  5346.             (const_string "clob")
  5347.             (const_string "nocond")))
  5348.  (set_attr "length" "8")])
  5349.  
  5350. (define_peephole
  5351.   [(parallel [(set (match_operand 0 "s_register_operand" "=rf")
  5352.            (call (mem:SI (match_operand:SI 1 "" "i"))
  5353.              (match_operand:SI 2 "general_operand" "g")))
  5354.           (clobber (reg:SI 14))])
  5355.    (return)]
  5356.   "(GET_CODE (operands[1]) == SYMBOL_REF && USE_RETURN_INSN
  5357.     && !get_frame_size () && !current_function_calls_alloca
  5358.     && !frame_pointer_needed && !current_function_args_size)"
  5359.   "*
  5360. {
  5361.   extern rtx arm_target_insn;
  5362.   extern int arm_ccfsm_state, arm_current_cc;
  5363.  
  5364.   if (arm_ccfsm_state && arm_target_insn && INSN_DELETED_P (arm_target_insn))
  5365.   {
  5366.     arm_current_cc ^= 1;
  5367.     output_return_instruction (NULL, TRUE);
  5368.     arm_ccfsm_state = 0;
  5369.     arm_target_insn = NULL;
  5370.   }
  5371.  
  5372.   output_return_instruction (NULL, FALSE);
  5373.   return \"b%?\\t%a1\";
  5374. }"
  5375. [(set (attr "conds")
  5376.       (if_then_else (eq_attr "cpu" "arm6")
  5377.             (const_string "clob")
  5378.             (const_string "nocond")))
  5379.  (set_attr "length" "8")])
  5380.  
  5381. ;; As above but when this function is not void, we must be returning the
  5382. ;; result of the called subroutine.
  5383.  
  5384. (define_peephole
  5385.   [(parallel [(set (match_operand 0 "s_register_operand" "=rf")
  5386.            (call (mem:SI (match_operand:SI 1 "" "i"))
  5387.              (match_operand:SI 2 "general_operand" "g")))
  5388.           (clobber (reg:SI 14))])
  5389.    (use (match_dup 0))
  5390.    (return)]
  5391.   "(GET_CODE (operands[1]) == SYMBOL_REF && USE_RETURN_INSN
  5392.     && !get_frame_size () && !current_function_calls_alloca
  5393.     && !frame_pointer_needed && !current_function_args_size)"
  5394.   "*
  5395. {
  5396.   extern rtx arm_target_insn;
  5397.   extern int arm_ccfsm_state, arm_current_cc;
  5398.  
  5399.   if (arm_ccfsm_state && arm_target_insn && INSN_DELETED_P (arm_target_insn))
  5400.   {
  5401.     arm_current_cc ^= 1;
  5402.     output_return_instruction (NULL, TRUE);
  5403.     arm_ccfsm_state = 0;
  5404.     arm_target_insn = NULL;
  5405.   }
  5406.  
  5407.   output_return_instruction (NULL, FALSE);
  5408.   return \"b%?\\t%a1\";
  5409. }"
  5410. [(set (attr "conds")
  5411.       (if_then_else (eq_attr "cpu" "arm6")
  5412.             (const_string "clob")
  5413.             (const_string "nocond")))
  5414.  (set_attr "length" "8")])
  5415.  
  5416. ;; If calling a subroutine and then jumping back to somewhere else, but not
  5417. ;; too far away, then we can set the link register with the branch address
  5418. ;; and jump direct to the subroutine.  On return from the subroutine
  5419. ;; execution continues at the branch; this avoids a prefetch stall.
  5420. ;; We use the length attribute (via short_branch ()) to establish whether or
  5421. ;; not this is possible, this is the same as the sparc does.
  5422.  
  5423. (define_peephole
  5424.   [(parallel[(call (mem:SI (match_operand:SI 0 "" "i"))
  5425.                    (match_operand:SI 1 "general_operand" "g"))
  5426.              (clobber (reg:SI 14))])
  5427.    (set (pc)
  5428.         (label_ref (match_operand 2 "" "")))]
  5429.   "0 && GET_CODE (operands[0]) == SYMBOL_REF 
  5430.    && short_branch (INSN_UID (insn), INSN_UID (operands[2]))
  5431.    && arm_insn_not_targeted (insn)"
  5432.   "*
  5433. {
  5434.   int backward = arm_backwards_branch (INSN_UID (insn),
  5435.                        INSN_UID (operands[2]));
  5436.  
  5437. #if 0
  5438.   /* Putting this in means that TARGET_6 code will ONLY run on an arm6 or
  5439.    * above, leaving it out means that the code will still run on an arm 2 or 3
  5440.    */
  5441.   if (TARGET_6)
  5442.     {
  5443.       if (backward)
  5444.     output_asm_insn (\"sub%?\\t%|lr, %|pc, #(8 + . -%l2)\", operands);
  5445.       else
  5446.     output_asm_insn (\"add%?\\t%|lr, %|pc, #(%l2 - . -8)\", operands);
  5447.     }
  5448.   else
  5449. #endif
  5450.     {
  5451.       output_asm_insn (\"mov%?\\t%|lr, %|pc\\t%@ protect cc\", operands);
  5452.       if (backward)
  5453.     output_asm_insn (\"sub%?\\t%|lr, %|lr, #(4 + . -%l2)\", operands);
  5454.       else
  5455.     output_asm_insn (\"add%?\\t%|lr, %|lr, #(%l2 - . -4)\", operands);
  5456.     }
  5457.   return \"b%?\\t%a0\";
  5458. }"
  5459. [(set (attr "conds")
  5460.       (if_then_else (eq_attr "cpu" "arm6")
  5461.             (const_string "clob")
  5462.             (const_string "nocond")))
  5463.  (set (attr "length")
  5464.       (if_then_else (eq_attr "cpu" "arm6")
  5465.             (const_int 8)
  5466.             (const_int 12)))])
  5467.  
  5468. (define_peephole
  5469.   [(parallel[(set (match_operand:SI 0 "s_register_operand" "=r")
  5470.           (call (mem:SI (match_operand:SI 1 "" "i"))
  5471.                         (match_operand:SI 2 "general_operand" "g")))
  5472.              (clobber (reg:SI 14))])
  5473.    (set (pc)
  5474.         (label_ref (match_operand 3 "" "")))]
  5475.   "0 && GET_CODE (operands[0]) == SYMBOL_REF
  5476.    && short_branch (INSN_UID (insn), INSN_UID (operands[3]))
  5477.    && arm_insn_not_targeted (insn)"
  5478.   "*
  5479. {
  5480.   int backward = arm_backwards_branch (INSN_UID (insn),
  5481.                        INSN_UID (operands[3]));
  5482.  
  5483. #if 0
  5484.   /* Putting this in means that TARGET_6 code will ONLY run on an arm6 or
  5485.    * above, leaving it out means that the code will still run on an arm 2 or 3
  5486.    */
  5487.   if (TARGET_6)
  5488.     {
  5489.       if (backward)
  5490.     output_asm_insn (\"sub%?\\t%|lr, %|pc, #(8 + . -%l3)\", operands);
  5491.       else
  5492.     output_asm_insn (\"add%?\\t%|lr, %|pc, #(%l3 - . -8)\", operands);
  5493.     }
  5494.   else
  5495. #endif
  5496.     {
  5497.       output_asm_insn (\"mov%?\\t%|lr, %|pc\\t%@ protect cc\", operands);
  5498.       if (backward)
  5499.     output_asm_insn (\"sub%?\\t%|lr, %|lr, #(4 + . -%l3)\", operands);
  5500.       else
  5501.     output_asm_insn (\"add%?\\t%|lr, %|lr, #(%l3 - . -4)\", operands);
  5502.     }
  5503.   return \"b%?\\t%a1\";
  5504. }"
  5505. [(set (attr "conds")
  5506.       (if_then_else (eq_attr "cpu" "arm6")
  5507.             (const_string "clob")
  5508.             (const_string "nocond")))
  5509.  (set (attr "length")
  5510.       (if_then_else (eq_attr "cpu" "arm6")
  5511.             (const_int 8)
  5512.             (const_int 12)))])
  5513.  
  5514. (define_split
  5515.   [(set (pc)
  5516.     (if_then_else (match_operator 0 "comparison_operator"
  5517.                [(match_operator:SI 1 "shift_operator"
  5518.              [(match_operand:SI 2 "s_register_operand" "r")
  5519.               (match_operand:SI 3 "reg_or_int_operand" "rM")])
  5520.             (match_operand:SI 4 "s_register_operand" "r")])
  5521.               (label_ref (match_operand 5 "" ""))
  5522.               (pc)))
  5523.    (clobber (reg 24))]
  5524.   ""
  5525.   [(set (reg:CC 24)
  5526.     (compare:CC (match_dup 4)
  5527.             (match_op_dup 1 [(match_dup 2) (match_dup 3)])))
  5528.    (set (pc)
  5529.     (if_then_else (match_op_dup 0 [(reg 24) (const_int 0)])
  5530.               (label_ref (match_dup 5))
  5531.               (pc)))]
  5532.   "
  5533.   operands[0] = gen_rtx (swap_condition (GET_CODE (operands[0])), VOIDmode,
  5534.              operands[1], operands[2]);
  5535. ")
  5536.  
  5537. (define_split
  5538.   [(set (match_operand:SI 0 "s_register_operand" "")
  5539.     (and:SI (ge:SI (match_operand:SI 1 "s_register_operand" "")
  5540.                (const_int 0))
  5541.         (neg:SI (match_operator:SI 2 "comparison_operator"
  5542.              [(match_operand:SI 3 "s_register_operand" "")
  5543.               (match_operand:SI 4 "arm_rhs_operand" "")]))))
  5544.    (clobber (match_operand:SI 5 "s_register_operand" ""))]
  5545.   ""
  5546.   [(set (match_dup 5) (not:SI (ashiftrt:SI (match_dup 1) (const_int 31))))
  5547.    (set (match_dup 0) (and:SI (match_op_dup 2 [(match_dup 3) (match_dup 4)])
  5548.                   (match_dup 5)))]
  5549.   "")
  5550.  
  5551. ;; This pattern can be used because cc_noov mode implies that the following
  5552. ;; branch will be an equality (EQ or NE), so the sign extension is not
  5553. ;; needed.  Combine doesn't eliminate these because by the time it sees the
  5554. ;; branch it no-longer knows that the data came from memory.
  5555.  
  5556. (define_insn ""
  5557.   [(set (reg:CC_NOOV 24)
  5558.     (compare:CC_NOOV
  5559.      (ashift:SI (subreg:SI (match_operand:QI 0 "memory_operand" "m") 0)
  5560.             (const_int 24))
  5561.      (match_operand 1 "immediate_operand" "I")))
  5562.    (clobber (match_scratch:SI 2 "=r"))]
  5563.   "((unsigned long) INTVAL (operands[1]))
  5564.    == (((unsigned long) INTVAL (operands[1])) >> 24) << 24"
  5565.   "*
  5566.   operands[1] = GEN_INT (((unsigned long) INTVAL (operands[1])) >> 24);
  5567.   output_asm_insn (\"ldr%?b\\t%2, %0\", operands);
  5568.   output_asm_insn (\"cmp%?\\t%2, %1\", operands);
  5569.   return \"\";
  5570. "
  5571. [(set_attr "conds" "set")
  5572.  (set_attr "length" "8")
  5573.  (set_attr "type" "load")])
  5574.  
  5575. (define_expand "prologue"
  5576.   [(clobber (const_int 0))]
  5577.   ""
  5578.   "
  5579.   arm_expand_prologue ();
  5580.   DONE;
  5581. ")
  5582.  
  5583. ;; This split is only used during output to reduce the number of patterns
  5584. ;; that need assembler instructions adding to them.  We allowed the setting
  5585. ;; of the conditions to be implicit during rtl generation so that
  5586. ;; the conditional compare patterns would work.  However this conflicts to
  5587. ;; some extend with the conditional data operations, so we have to split them
  5588. ;; up again here.
  5589.  
  5590. (define_split
  5591.   [(set (match_operand:SI 0 "s_register_operand" "")
  5592.     (if_then_else:SI (match_operator 1 "comparison_operator"
  5593.               [(match_operand 2 "" "") (match_operand 3 "" "")])
  5594.              (match_operand 4 "" "")
  5595.              (match_operand 5 "" "")))
  5596.    (clobber (reg 24))]
  5597.   "reload_completed"
  5598.   [(set (match_dup 6) (match_dup 7))
  5599.    (set (match_dup 0) 
  5600.     (if_then_else:SI (match_op_dup 1 [(match_dup 6) (const_int 0)])
  5601.              (match_dup 4)
  5602.              (match_dup 5)))]
  5603.   "
  5604. {
  5605.   enum machine_mode mode = SELECT_CC_MODE (GET_CODE (operands[1]), operands[2],
  5606.                        operands[3]);
  5607.  
  5608.   operands[6] = gen_rtx (REG, mode, 24);
  5609.   operands[7] = gen_rtx (COMPARE, mode, operands[2], operands[3]);
  5610. }
  5611. ")
  5612.  
  5613.  
  5614. (define_insn ""
  5615.   [(set (match_operand:SI 0 "s_register_operand" "=r,r")
  5616.     (if_then_else:SI (match_operator 4 "comparison_operator"
  5617.               [(match_operand 3 "reversible_cc_register" "")
  5618.                (const_int 0)])
  5619.              (match_operand:SI 1 "arm_rhs_operand" "0,?rI")
  5620.              (not:SI
  5621.               (match_operand:SI 2 "s_register_operand" "r,r"))))]
  5622.   ""
  5623.   "@
  5624.    mvn%D4\\t%0, %2
  5625.    mov%d4\\t%0, %1\;mvn%D4\\t%0, %2"
  5626. [(set_attr "conds" "use")
  5627.  (set_attr "length" "4,8")])
  5628.  
  5629. ;; The next two patterns occur when an AND operation is followed by a
  5630. ;; scc insn sequence 
  5631.  
  5632. (define_insn ""
  5633.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  5634.     (sign_extract:SI (match_operand:SI 1 "s_register_operand" "r")
  5635.              (const_int 1)
  5636.              (match_operand:SI 2 "immediate_operand" "n")))]
  5637.   ""
  5638.   "*
  5639.   operands[2] = GEN_INT (1 << INTVAL (operands[2]));
  5640.   output_asm_insn (\"ands\\t%0, %1, %2\", operands);
  5641.   return \"mvnne\\t%0, #0\";
  5642. "
  5643. [(set_attr "conds" "clob")
  5644.  (set_attr "length" "8")])
  5645.  
  5646. (define_insn ""
  5647.   [(set (match_operand:SI 0 "s_register_operand" "=r")
  5648.     (not:SI
  5649.      (sign_extract:SI (match_operand:SI 1 "s_register_operand" "r")
  5650.               (const_int 1)
  5651.               (match_operand:SI 2 "immediate_operand" "n"))))]
  5652.   ""
  5653.   "*
  5654.   operands[2] = GEN_INT (1 << INTVAL (operands[2]));
  5655.   output_asm_insn (\"tst\\t%1, %2\", operands);
  5656.   output_asm_insn (\"mvneq\\t%0, #0\", operands);
  5657.   return \"movne\\t%0, #0\";
  5658. "
  5659. [(set_attr "conds" "clob")
  5660.  (set_attr "length" "12")])
  5661.  
  5662. ;; Push multiple registers to the stack.  The first register is in the
  5663. ;; unspec part of the insn; subsequent registers are in parallel (use ...)
  5664. ;; expressions.
  5665. (define_insn ""
  5666.   [(match_parallel 2 "multi_register_push"
  5667.     [(set (match_operand:BLK 0 "memory_operand" "=m")
  5668.       (unspec:BLK [(match_operand:SI 1 "s_register_operand" "r")] 2))])]
  5669.   ""
  5670.   "*
  5671. {
  5672.   char pattern[100];
  5673.   int i;
  5674.   extern int lr_save_eliminated;
  5675.  
  5676.   if (lr_save_eliminated)
  5677.     {
  5678.       if (XVECLEN (operands[2], 0) > 1)
  5679.     abort ();
  5680.       return \"\";
  5681.     }
  5682.   strcpy (pattern, \"stmfd\\t%m0!, {%|%1\");
  5683.   for (i = 1; i < XVECLEN (operands[2], 0); i++)
  5684.     {
  5685.       strcat (pattern, \", %|\");
  5686.       strcat (pattern, reg_names[REGNO (XEXP (XVECEXP (operands[2], 0, i),
  5687.                           0))]);
  5688.     }
  5689.   strcat (pattern, \"}\");
  5690.   output_asm_insn (pattern, operands);
  5691.   return \"\";
  5692. }"
  5693. [(set_attr "type" "store4")])
  5694.